wpfui icon indicating copy to clipboard operation
wpfui copied to clipboard

Image is not binding properly from view model ImageSource

Open mwpowellhtx opened this issue 1 year ago • 2 comments

Describe the bug

As stated in title, binding is failing to show the ImageSource properly.

To Reproduce

I am extracting an InteropBitmap from an executable file, which in and of itself is fine. But the binding is not reflected in the view control.

In my view, doing the simple thing as follows:

<ui:Image Grid.Column="2" Width="24" Height="24" Margin="2" Source="{Binding ApplicationImageSource, Mode=OneWay}" />

Nothing at all that fancy about that.

Expected behavior

This after apparently falling back on the stock WPF Image, which actually is a FrameworkElement, a UIElement.

<Image Grid.Column="2" Width="24" Height="24" Margin="2" Source="{Binding ApplicationImageSource, Mode=OneWay}" />

This "just works", not sure why yours does not. Benefit of the doubt, of course, I would like to be using yours, but I cannot today. Unless I am doing something wrong, but as shown by the image, the view model is correct, the stock element works.

Whereas Wpf.Ui.Controls.Image is a Control, which is also FrameworkElement, so not really seeing the difference there leading to my bit of chagrin, as to why this is such a perplexity.

Screenshots

Would expect something along these lines.

image

OS version

#n/a

.NET version

Target framework net8.0-windows

WPF-UI NuGet version

Latest 3.0

Additional context

No response

mwpowellhtx avatar Feb 22 '24 23:02 mwpowellhtx

Any update toward this? Acknowledgement at least? Repeatability? Again, the only thing I did was to sub in the stock <Image/> for the Wpf.Ui one, and that "fixed" it. Benefit of the doubt, if there is an overt advantage to using the Wpf.Ui moving forward, of course I want to do that instead. Best...

mwpowellhtx avatar Feb 24 '24 19:02 mwpowellhtx

Had the same issue, but my issue was i simply forgot to reference the themes as follows


<UserControl   x:Class="MyApp.Ui.NewWorkbook"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
               mc:Ignorable="d"
             d:DesignHeight="450" d:DesignWidth="800">

   <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ui:ThemesDictionary Theme="Dark" />
                <ui:ControlsDictionary />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

Not sure if this resolves your issue?

HarryPitsillides avatar Jun 04 '24 16:06 HarryPitsillides