【发布时间】:2011-03-06 19:22:32
【问题描述】:
有没有办法在一个 TextBlock 中结合静态文本和绑定?因为 StringFormat 在 windows phone 7 中不起作用。 我试试
<TextBlock Text="{Binding strAudioArtistName, StringFormat=StaticText: {0}}"/>
但不工作....
谢谢
【问题讨论】:
标签: silverlight windows-phone-7
有没有办法在一个 TextBlock 中结合静态文本和绑定?因为 StringFormat 在 windows phone 7 中不起作用。 我试试
<TextBlock Text="{Binding strAudioArtistName, StringFormat=StaticText: {0}}"/>
但不工作....
谢谢
【问题讨论】:
标签: silverlight windows-phone-7
实际上,如果您可以更改视图模型并在属性中进行格式化,您将获得比依赖 IValueConverter 更好的性能。
我使用这些模式仍然给我属性更改通知
string _value;
public string Value { get { return _value; } set { _value = value; NotifyPropertyChanged("Value"); NotifyPropertyChanged("ValueFormatted"); } }
public string ValueFormatted { get { return "Static Text: " + _value; } }
【讨论】:
WP7 使用Silverlight 3。所以,你不会得到StringFormat。请改用IValueConverter。
【讨论】: