WPF BitmapSource ImageSource

前端 未结 3 1963
有刺的猬
有刺的猬 2021-01-12 14:24

I am binding an Image.Source property to the result of the property shown below.

public BitmapSource MyImageSource
{
    get
    {
        BitmapSource sour         


        
3条回答
  •  不要未来只要你来
    2021-01-12 14:45

    Also, have you tried just using a BitmapImage to load the image? It works fine with PNG, BMP, and JPEG.

    It's also a specialized type of BitmapSource, so you could just replace your code in your property with this:

    BitmapImage img = new BitmapImage(new Uri(@"C:\Temp\logo.png"));
    return img;
    

提交回复
热议问题