views:

305

answers:

2

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 storyboards

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

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?

A: 

You could try the ActualHeight property. It is a double.

James Keesey
Now I receive this error: 'ActualHeight' Storyboard.TargetProperty path does not point to a DependencyProperty.
Alin
+2  A: 

The answer is here http://www.codeproject.com/KB/WPF/GridLengthAnimation.aspx

Alin
Thanks--answered my problem. +1
David Veeneman