StringFormat in wp7?

前端 未结 2 1570
小蘑菇
小蘑菇 2021-01-19 22:54

Is there a way to combine static text AND binding in one TextBlock? Because StringFormat don\'t work in windows phone 7. I try



        
相关标签:
2条回答
  • 2021-01-19 23:31

    WP7 uses Silverlight 3. So, you don't get StringFormat. Use IValueConverter instead.

    0 讨论(0)
  • 2021-01-19 23:48

    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; } }
    

    0 讨论(0)
提交回复
热议问题