views:

551

answers:

2

I have a ListView, that is defined very simply in my XAML like so

<ListView Name="myListVew" MaxHeight="200" Visibility="Collapsed">
    <ListView.View>
        <GridView>
            <GridViewColumn Header="Line" Width="Auto" DisplayMemberBinding="{Binding Line}" />
            <GridViewColumn Header="Error" Width="Auto" DisplayMemberBinding="{Binding Error}" />
        </GridView>
    </ListView.View>
</ListView>

When I want the ListView to appear, I want to animate the height of the list view from 0. The problem is, I don't know the final height of the ListView since it will depend on how many items are shown inside it. Is there anyway of doing this?

+2  A: 

Don't you hate it when you search for hours for a solution, post a question to a forum and then find the answer yourself 10 minutes later?

Anyway, I got it working by applying a layout scale transform like so

<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ErrorDisplay" Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
</DoubleAnimationUsingKeyFrames>
Ray
This might satisfy you, but does it really answer your original question? I thought you wanted to increase the height of the control, but not scale its contents as you do so.
Mal Ross
A: 

can anybody provide a simple sample using this for a popup control?

wpf
You're better to ask it as a separate question, no-one will see this, and it's not an answer to this question.
Ray