我有一个bool值,我需要在TextBlock中显示为"是"或"否".我试图用StringFormat做这个,但我的StringFormat被忽略,TextBlock显示"True"或"False".
<TextBlock Text="{Binding Path=MyBoolValue, StringFormat='{}{0:Yes;;No}'}" />
Run Code Online (Sandbox Code Playgroud)
我的语法有问题,还是不支持这种类型的StringFormat?
我知道我可以使用ValueConverter来实现这一目标,但StringFormat解决方案看起来更优雅(如果有效).