4

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}}"/>

but don't work....

Thank

decyclone
  • 30,394
  • 6
  • 63
  • 80
trickui
  • 297
  • 5
  • 19

2 Answers2

7

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; } }
Chris Sainty
  • 9,086
  • 1
  • 26
  • 31
5

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

decyclone
  • 30,394
  • 6
  • 63
  • 80