How to set FallbackValue in binding as path to external image file?

前端 未结 2 1929
梦毁少年i
梦毁少年i 2021-02-20 09:42

I\'m trying to set FallbackValue in case when my converter cannot be call, but I\'m not sure how to do that.



        
2条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-20 10:05

    For the Image control, when you Binding the Source property with a URI string, it will automatically convert the URI to a BitmapImage. But if you set the FallbackValue and TargetNullValue as URI string, it will not display.

    You need to set it as BitmapImage:

    
        
    
    
    
    

    As we set the FallbackValue and the TargetNullValue as StaticResource of BitmapImage, It works.

提交回复
热议问题