Data Binding: Multiple Sources for a Single Object

I want to bind one property to several sources. My reason for this is things like this:

midpoint=point2.X - point1.X; //depends on two sources! 

How can this be implemented? As far as I know, this is not possible right out of the box?

+6
data-binding wpf binding
source share
1 answer

I believe you are looking for MultiBinding .

From the MSDN documentation:

 <TextBlock Name="textBox2" DataContext="{StaticResource NameListData}"> <TextBlock.Text> <MultiBinding Converter="{StaticResource myNameConverter}" ConverterParameter="FormatLastFirst"> <Binding Path="FirstName"/> <Binding Path="LastName"/> </MultiBinding> </TextBlock.Text> </TextBlock> 
+7
source share

All Articles