Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data Binding: multiple sources for one property

I want to bind one property to multiple sources. My reason for this are things like this:

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

How could this be realised? As far as I know it's not directly possible out-of-the-box?

like image 736
stefan.at.wpf Avatar asked Apr 12 '10 19:04

stefan.at.wpf


1 Answers

I believe what you are looking for is a 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>
like image 75
Taylor Leese Avatar answered Oct 08 '22 21:10

Taylor Leese