Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WPF
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:
 
<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 1-Dec-12 0:36am
Edited 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)



Advertise | Privacy | Mobile
Web02 | 2.8.141022.2 | Last Updated 1 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100