wp7中的StringFormat? [英] StringFormat in wp7?
本文介绍了wp7中的StringFormat?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法在一个 TextBlock 中结合静态文本和绑定?因为 StringFormat 在 Windows Phone 7 中不起作用.我试试
Is there a way to combine static text AND binding in one TextBlock? Because StringFormat don't work in windows phone 7. I try
<TextBlock Text="{Binding strAudioArtistName, StringFormat=StaticText: {0}}"/>
但不工作....
谢谢
推荐答案
实际上,如果您可以更改视图模型并在属性中进行格式化,您将获得比依赖 IValueConverter 更好的性能.
Actually if you can change your viewmodel and do the formatting in a property you will get much better performance than relying on an IValueConverter.
我使用沿这些方式的模式仍然给我属性更改通知
I use a pattern along these lines to still give me property change notifications
string _value;
public string Value { get { return _value; } set { _value = value; NotifyPropertyChanged("Value"); NotifyPropertyChanged("ValueFormatted"); } }
public string ValueFormatted { get { return "Static Text: " + _value; } }
这篇关于wp7中的StringFormat?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文