Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Animate UserControl on removing in wpf

$
0
0

Hello Friends

I using this XAML Code for my UC (UserControl) to animate it on startup:

<UserControl.Triggers><EventTrigger RoutedEvent="UserControl.Loaded"><BeginStoryboard><Storyboard><DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:1"/></Storyboard></BeginStoryboard></EventTrigger></UserControl.Triggers>

Its works fine when I trying to add this UC to MainWindow.

But I don't know how Animate UC on removing it from MainWindow by this code on Behind Code:

((Panel)Parent).Children.Remove(this);

I tried this XAML code but its doesn't worked:

<EventTrigger RoutedEvent="UserControl.Unoaded"><BeginStoryboard><Storyboard><DoubleAnimation Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="00:00:1"/></Storyboard></BeginStoryboard></EventTrigger>

Can you help me?

Thank you


:)


Viewing all articles
Browse latest Browse all 18858

Trending Articles