How to set a default source for an Image if binding source is null?
问题 I'm using binding for source of an Image control. <Image Source="{Binding ImageUri}"/> But this ImageUri can be null, therefor I want to use a default image, a place holder, for that, which can be in /Assets/PlaceHolder.png for example. How can I set a default image? thanks. (It's a WP8 app, but should not be different of WPF) 回答1: You can achieve it by setting TargetNullValue <Image> <Image.Source> <Binding Path="ImageUri" > <Binding.TargetNullValue> <ImageSource>/Assets/PlaceHolder.png<