I have 3 wpf control name “A” “B” “C”. I want to bind C control height.
Easy understand: C.Height=A.Height+B.Height
This is my dream. 🙂
< C >
< C.Height >
< SumBinding >
< Binding ElementName=A, Path=Height/ >
< Binding ElementName=B, Path=Height/ >
< /SumBinding >
< /C.Height >
< /C >
How to do it?
Is it possible to do not using converter?
Otherwise possible to create SumBinding like class?
You can bind a property to multiple bindings using a MultiBinding, although you will need to use a converter implementing IMultiValueConverter in order to use them. In this case, you will probably want to bind to Height rather than ActualHeight so that you get the value after layout is performed.
You would define a converter like this:
And then do something like this in XAML:
If you’re just trying to get the height of controls to be in a fixed ratio with each other, you might want to use a Grid with star sizing or multiple grids with shared size groups. Something like this might work: