tags:

views:

32

answers:

1
+1  A: 

MSDN says the StringFormat property gets or sets a string that specifies how to format the binding if it displays the bound value as a string.

Since you are using its value, and not displaying it in the multibinding, it will use the value in your MultiBinding StringFormat.

In short: StringFormat on Bindings in MultiBindings will be ignored so to speak.

When you use a MultiBinding, the StringFormat property applies only when it is set on the MultiBinding. The value of StringFormat that is set on any child Binding objects is ignored. The number of parameters in a composite string format cannot exceed the number of child Binding objects in the MultiBinding.

Workaround: expand the MultiBinding StringFormat:

StringFormat="{}{0} 
{1}
{2}
{3}, {4} {5}"

But I guess you could figure that one out as well ;)

Arcturus
Thank you. I actually just realized what I tried was stupid, even if it did work I wouldnt get the results I was looking for. Do you have an idea how to go about conditionaly inserting a newline?
Fragilerus
No problem! You could use a Converter, or an all Xaml solution: use a DataTemplate, style it, and add triggers to hide lines, place it on a ContentControl, and let the Content property bind to your DataContext.
Arcturus