I am implementing this TextBlock and the stringformat is not appearing, only the value of the binding property. Can you tell me what I'm doing wrong?
XAML CODE
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource ResourceKey=myConverter}">
<Binding Path="loc.country" StringFormat="Country: {0}"/>
<Binding Path="loc.area" StringFormat="Area: {0}"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
Converter
public class MyMultiConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values[1] == null)
return values[0];
return values[1];
}
public object[] ConvertBack(object values, Type[] targetType, object parameter, CultureInfo culture)
{
return null;
}
}
Best regards,