Newline or carriage return in Multibind StringFormat

So, I have the following:

<TextBlock.Text> <MultiBinding StringFormat="So and so will donate {0:C0}&#x0d;&#x0a;to {1}, bringing the&#x0d;&#x0a;total amount to {2:C0}."> <Binding Path="VisitorTotal" /> <Binding Path="EventName" /> <Binding Path="EventTotal" /> </MultiBinding> </TextBlock.Text> 

I tried &#x0d;&#x0a; , &#10; , \n , \\n and various combinations. Nothing will give me a new line. What a deal?

+6
source share
1 answer

My preference is to use Environment.NewLine directly:

 <MultiBinding StringFormat="So and so will donate {0:C0}{3}to {1}, bringing the{3}total amount to {2:C0}."> <Binding Path="VisitorTotal" /> <Binding Path="EventName" /> <Binding Path="EventTotal" /> <Binding Source="{x:Static System:Environment.NewLine}"/> </MultiBinding> 

However, you also need to make sure that TextBlock.TextWrapping set appropriately.

+16
source

All Articles