Click here to Skip to main content
15,884,628 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.
The problem: I want to animate adding and removing items from list view item, it is work for adding but removing did not work, i Will post the code and tel me where is the error how how i can do it??


XAML code:

HTML
<window.resources>

        <controltemplate x:key="template" targettype="{x:Type ListViewItem}" xmlns:x="#unknown">
            <border removed="Red" cornerradius="5">
                <Label Content="{Binding Path=Name}" />
            </border>
        </controltemplate>
        <Style x:Key="Containerstyle" TargetType="{x:Type ListViewItem}">
            <setter property="Margin" value="2" />
            <setter property="Height" value="30" />
            <setter property="Template" value="{StaticResource template}" />

            <Style.Triggers>
                <eventtrigger routedevent="Loaded">
                    <eventtrigger.actions>
                        <beginstoryboard>
                            <storyboard>
                                <doubleanimation storyboard.targetproperty="Opacity" from="0" to="1" duration="0:0:2">
                                </doubleanimation>
                            </storyboard>
                        </beginstoryboard>
                    </eventtrigger.actions>
                </eventtrigger>

                <eventtrigger routedevent="Unloaded">
                    <eventtrigger.actions>
                        <beginstoryboard>
                            <storyboard>
                                <doubleanimation storyboard.targetproperty="Opacity" from="1" to="1" duration="0:0:0" />
                                <doubleanimation storyboard.targetproperty="Opacity" from="1" to="0" duration="0:0:2">
                                </doubleanimation>
                            </storyboard>
                        </beginstoryboard>
                    </eventtrigger.actions>
                </eventtrigger>
            </Style.Triggers>
        </Style>


    </window.resources>
    <grid>
        <listview height="217" horizontalalignment="Left" margin="111,12,0,0" name="listView1" verticalalignment="Top" width="254">
                   ItemsSource="{Binding Path=ListPerson}" />

        <Button Content="Add" Height="32" HorizontalAlignment="Left" Margin="119,252,0,0" Name="button1" VerticalAlignment="Top" Width="122" Click="button1_Click" />
        <Button Content="remove" Height="32" HorizontalAlignment="Left" Margin="263,252,0,0" Name="button2" VerticalAlignment="Top" Width="122" Click="button2_Click" />
    </listview></grid>
Posted
Updated 1-Dec-12 0:40am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900