Alb*_*Gao 0 c# silverlight xaml windows-phone-7
我有什么:
1.XAML中的文本块
2.来自数据库的查询,其中包含DateTime?类型数据.
我的工作:
1.我用DateTime声明一个"myClass"类?
我想要的参数名称为"myDate"
1.在文本块中显示MyDate [我知道]
2.当"myDate"的值为null时,在文本块中显示一个字符串.[我不知道,因为Get方法只能返回DateTime?类型值,但不是字符串类型.]
小智 5
尝试将Binding与您的文本块一起使用,如下所示:
<TextBlock Text="{Binding myDate, TargetNullValue='Your null message'"/>
Run Code Online (Sandbox Code Playgroud)