Reputation: 145
I have two properties, Related_Id and PageNumber. I want to bind these two values to a single label.
XAML code
<StackPanel>
<sdk:Label x:Name="RelatedItemIdLabel"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="{Binding CreateMessage.RelatedId}" />
</StackPanel>
current output: Related_Id
Desired output: Related_Id/ PageNumber
Could anyone help me to find a solution..
Thanks..
Upvotes: 1
Views: 3596
Reputation: 4464
This is the code you're looking for :
<StackPanel>
<sdk:Label x:Name="RelatedItemIdLabel"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<sdk:Label.Content>
<MultiBinding StringFormat=" {0}, {1}">
<Binding Path="{Binding CreateMessage.RelatedId}"/>
<Binding Path="{Binding CreateMessage.PageNumber}"/>
</MultiBinding>
</sdk:Label.Content>
</sdk:Label>
</StackPanel>
Upvotes: -1
Reputation: 703
Try this:
<Label x:Name="RelatedItemIdLabel"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<Label.Content>
<MultiBinding StringFormat=" {0}/{1}">
<Binding Path="" /> //insert field 1
<Binding Path="" /> //insert field 2
</MultiBinding>
</Label.Content>
</Label>
Upvotes: 2