How to refer to Embedded Resources from XAML?

前端 未结 4 720
被撕碎了的回忆
被撕碎了的回忆 2020-12-03 16:52

I have several images that i want to be Embedded into the exe.

When i set the Build Action to Embedded Resource I get through out t

4条回答
  •  庸人自扰
    2020-12-03 17:36

    ImageSource cannot be instantiated.

    public abstract class ImageSource : Animatable, 
    IFormattable
    

    There's that little abstract in there which will screw your day up. Your xaml is actually trying to instantiate an instance of ImageSource, then assign the value within the element (your Uri, in this case) to a property marked with the ContentPropertyAttribute (??) using whatever converter that could be located to convert the string to an object (again, ??).

    I think you want a BitmapSource.

    
    

提交回复
热议问题