0

I'm trying to format display the following text using StringFormat in XAML, but I don't know where to enter the "Current Temperature: " string here:

<TextBlock Text="{Binding TempText, StringFormat={"Current Temperature: "}{0}°C}" 

The final output should be:

Current Temperature: 10°C
Frédéric Hamidi
  • 258,201
  • 41
  • 486
  • 479
Vahid
  • 5,144
  • 13
  • 70
  • 146
  • 1
    Have a look here: http://stackoverflow.com/questions/2552853/how-to-bind-multiple-values-to-a-single-wpf-textblock – RoelV Dec 03 '14 at 10:57

2 Answers2

3

The following code gives you the required output.

<TextBlock Text="{Binding TempText, StringFormat='Current Temperature: {0} &#186; C'}"/>
Jawahar
  • 4,775
  • 1
  • 24
  • 47
0

You may use MultiBinding along with StringFormat

this msdn may help:

"http://msdn.microsoft.com/en-us/library/system.windows.data.bindingbase.stringformat%28v=vs.110%29.aspx"

MBDevelop
  • 103
  • 1
  • 11