Is there a way to do simple calculations in a xaml element binding statement other than using a conv

Posted by Jonathan Websdale on Stack Overflow See other posts from Stack Overflow or by Jonathan Websdale
Published on 2010-03-25T08:43:11Z Indexed on 2010/03/25 9:43 UTC
Read the original article Hit count: 330

Filed under:
|
|
|

In XAML I want to bind the height of one element to be half the height of another element. Is there a way to do this that doesn't involve writing a converter in the code-behind?

Example:- What I've got...

<Button Name="RemoveButton" Content="Remove Stage" Width="100" Height="{Binding  ElementName=AddButton, Path=Height, Converter={StaticResource MyHalfHeightConverter}}"/>

What I'd like...

<Button Name="RemoveButton" Content="Remove Stage" Width="100" Height="{Binding ElementName=AddButton, Path=(Height / 2.0)}"/>

© Stack Overflow or respective owner

Related posts about xaml

Related posts about wpf