How to get a Uri of the image stored in the resources

后端 未结 2 1326
日久生厌
日久生厌 2020-11-27 20:26

I have two .png files added to my resources which I need to access their Uri when doing binding.

My xaml code is as followed:



        
2条回答
  •  醉梦人生
    2020-11-27 21:12

    Declare the Properties.Resources.LedGreen property as ImageSource and set it to Uri location rather than the Bitmap object.

    Or if you insist of storing it as a bitmap you can get the source by returning Properties.Resources.LedGreen.ImageSource which will be of type ImageSource.

    I would prefer the first approach.

提交回复
热议问题