Вопрос

So i've got 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've tried &#x0d;&#x0a;, &#10;, \n, \\n, and various combinations thereto. Nothing will give me a newline. What's the deal?

Это было полезно?

Решение

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'll also need to make sure the TextBlock.TextWrapping is set appropriately.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top