I’m currently using the TextBlock below to bind the value of a property named Name:
<TextBlock Text="{Binding Name}" />
Now, I want to bind another property named ID to the same TextBlock.
Is it possible to bind two or more values to the same TextBlock? Can it be done with simple concatenation, like Name + ID and, if not, how else could this be approached?
You can use a
MultiBindingcombined with theStringFormatproperty. Usage would resemble the following:Giving
Namea value ofFooandIDa value of1, your output in the TextBlock would then beFoo + 1.Note: This is only supported in .NET 3.5 SP1 and 3.0 SP2 or later.