【发布时间】:2013-11-14 14:16:46
【问题描述】:
如果绑定值为空,我想分配一个占位符。答案是TargetNullValue,但我不知道如何实际使用!
这里说ImageSource 无效:
<Image>
<Image.Source>
<Binding Path="ImageUri" >
<Binding.TargetNullValue>
<ImageSource>/Assets/PlaceHolder.png</ImageSource>
</Binding.TargetNullValue>
</Binding>
</Image.Source>
</Image>
【问题讨论】:
-
或者你可以这样写:
<Image Source="{Binding Path=ImageUri , TargetNullValue='/Assets/PlaceHolder.png' , FallBackValue='/Assets/Placeholder.png'}">
标签: c# xaml windows-phone-7 windows-phone-8 windows-phone