0

I've defined access to my resources for my WPF project in XAML as follows:

xmlns:properties="clr-namespace:MyProject.Properties"

Now I want to make use of this in my XAML view following these guidelines, i.e.,

<Image Height="100">
  <Image.Source>
    <BitmapImage DecodePixelHeight="60" UriSource="{x:Static properties:Resources.MyImage"/>
  </Image.Source>
</Image>

However, binding to resources returns a Bitmap and not the required Uri type. How do I correctly reference my Bitmap in XAML as the source for an image?

N.B. I want to avoid hard-coded path strings in XAML, hence the reference to properties.

James B
  • 8,975
  • 13
  • 45
  • 83

0 Answers0