2010-01-07 6 views
4

У меня есть Grid с 2-мя рядами:как изменить высоту строки сетки в WPF с использованием раскадровки

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

и 2 Storyboard ы:

<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

Ответ здесь [http://www.codeproject.com/KB/WPF/GridLengthAnimation.aspx](http://www.codeproject.com/KB/WPF/GridLengthAnimation.aspx) – Alin

ответ

-2

Вы можете попробовать ActualHeight. Это double.

+2

Теперь я получаю это error: «Stringboard» ActualHeight.TargetProperty не указывает на DependencyProperty. – Alin

Смежные вопросы