how to change the height of a grid row in wpf using storyboard
I have a Grid
with 2 rows:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="150"/>
<RowDefinition />
<RowDefinition Height="Auto" x:Name="OtherContactsRow" />
</Grid.RowDefinitions>
Something here
</Grid>
and 2 Storyboard
s:
<Storyboard x:Key="MaximizedStoryboard">
<DoubleAnimation From="20" To="150" Duration="0:0:2"
Storyboard.TargetName="OtherContactsRow"
Storyboard.TargetPr开发者_JAVA技巧operty="Height" >
</DoubleAnimation>
</Storyboard>
<Storyboard x:Key="MinimizedStoryboard">
<DoubleAnimation From="150" To="20" Duration="0:0:2"
Storyboard.TargetName="OtherContactsRow"
Storyboard.TargetProperty="Height">
</DoubleAnimation>
</Storyboard>
When I try to modify the height of the row named OtherContactsRow
I received the following error:
'System.Windows.Media.Animation.DoubleAnimation' animation object cannot be used to animate property 'Height' because it is of incompatible type 'System.Windows.GridLength'.
Any solutions?
You could try the ActualHeight
property. It is a double
.
精彩评论