5

我有Grid2 行:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="150"/>
        <RowDefinition />
        <RowDefinition Height="Auto" x:Name="OtherContactsRow" />
    </Grid.RowDefinitions>
    Something here
</Grid>

和 2Storyboard秒:

<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'.

有什么解决办法吗?

4

1 回答 1

-3

你可以试试ActualHeight楼盘。它是一个double.

于 2010-01-07T00:53:51.987 回答