I've got a storyboard that I use to change the size of a Grid when a ToggleButton is pressed but the Grid's Height is hardcoded. How do I set its Height based on some other element but also add extra pixels to it? To be more specific, I want the Grid to be 50pt when collapsed but when expanded it should be 50pt+Height of another element (which will be shown in the Grid, in the extra space).
<Style TargetType="{x:Type Grid}" x:Key="ExpandCollapseTopBar">
<Style.Triggers>
<EventTrigger RoutedEvent="ToggleButton.Checked">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="(Grid.Height)" From="50.0" To="100.0" Duration="0:0:0.1"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="ToggleButton.Unchecked">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="(Grid.Height)" From="100.0" To="50.0" Duration="0:0:0.1"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Style.Triggers>
</Style>
I would use binding to the other element's Height but then I cannot add the extra pixels.
Height="{Binding ElementName=TheOtherElement, Path=ActualHeight}"