You cannot install MultiBindingwhitout MultiValueConverter.
Try the following:
<ItemsControl Name="ItemsDisplay">
<ItemsControl.Resources>
<local:MyMultiConv x:Key="MyConv"/>
</ItemsControl.Resources>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<StackPanel Grid.Column="1">
<Label Name="ItemName" Margin="10">
<Label.Content>
<MultiBinding Converter="{StaticResource MyConv}">
<Binding Path="name" />
<Binding Path="typeLine" />
</MultiBinding>
</Label.Content>
</Label>
</StackPanel>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
And the converter:
public class MyMultiConv : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
return string.Format("{0} {1}", values[0], values[1]);
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
Edit
If you bind directly to TextProperty, you really can:
<Textblock Name="ItemName" Margin="10">
<Textblock.Text>
<MultiBinding StringFormat="{}{0} {1}">
<Binding Path="name" />
<Binding Path="typeLine" />
</MultiBinding>
</Textblock.Text>
</Textblock>
source
share