0

How to load images xaml in WPF having build action embedded resources without changing build action of this image.

"<BitmapImage UriSource="pack://application:,,,/Assets/Images/clock_6.png" x:Key="clock_6"/>"

I tried above but throwing "cannot locate resource" exception.

  • 2
    The Build Action should not be *Embedded Resource*, but instead *Resource*. Then load the image by a Resource File Pack URI, e.g. as shown here: https://stackoverflow.com/a/25714375/1136211 – Clemens Jan 20 '23 at 13:11
  • 1
    If you can not change the Build Action, see here: https://stackoverflow.com/a/29198173/1136211 – Clemens Jan 20 '23 at 13:29
  • By images xaml do you just mean like a png file? In which case I think Clemens advice covers it. Or is "images xaml" something else? – Andy Jan 20 '23 at 14:32

0 Answers0