我有Grid
有2行:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="150"/>
<RowDefinition />
<RowDefinition Height="Auto" x:Name="OtherContactsRow" />
</Grid.RowDefinitions>
Something here
</Grid>
和2 Storyboard
s:
<Storyboard x:Key="MaximizedStoryboard">
<DoubleAnimation From="20" To="150" Duration="0:0:2"
Storyboard.TargetName="OtherContactsRow"
Storyboard.TargetProperty="Height" >
</DoubleAnimation>
</Storyboard>
<Storyboard x:Key="MinimizedStoryboard">
<DoubleAnimation From="150" To="20" Duration="0:0:2"
Storyboard.TargetName="OtherContactsRow"
Storyboard.TargetProperty="Height">
</DoubleAnimation>
</Storyboard>
当我尝试修改名为OtherContactsRow
的行的高度时,收到以下错误:
'System.Windows.Media.Animation.DoubleAnimation' animation object cannot be used to animate property 'Height' because it is of incompatible type 'System.Windows.GridLength'.
任何解决方案?
答案 0 :(得分:-2)
您可以尝试ActualHeight
属性。这是double
。