Reputation: 1109
I have the following code in my test project:
<StackPanel>
<TextBlock Height="50" Text="{Binding First}" />
<TextBlock Height="50" Text="{Binding Last}" />
<TextBlock Height="50" >
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} + {1}}">
<Binding Path="First" />
<Binding Path="Last" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</StackPanel>
First and Last are string properties:
public string First { get; set; }
public string Last { get; set; }
public MainWindowViewModel()
{
First = "First";
Last = "Last";
}
The first two TextBlocks with the single binding work as expected, but the one with the Multibinding doesn't. If possible, I want to avoid using a converter What's wrong with my code?
Upvotes: 0
Views: 67
Reputation: 440
MultiBinding works from NET .NET 3.5 SP1
And you got the typo, remove last bracket "}" in String-Format
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} + {1}">
<Binding Path="First" />
<Binding Path="Last" />
</MultiBinding>
</TextBlock.Text>
Please let know if solution works for you
Upvotes: 1