Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF : Animating user Control on load

Tags:

wpf

c#-4.0

I am developing an application in which I have a user control inside a window. I want to perform some growing animation on the size of that control when it gets attached to the window. Can anyone help me with it ??

like image 934
VJEY Avatar asked May 03 '11 12:05

VJEY


1 Answers

In your styling:

<YourControl.Triggers>
    <EventTrigger RoutedEvent="YourControl.Loaded">
        <BeginStoryboard>
          <Storyboard>
            <DoubleAnimation Storyboard.TargetProperty="Width" From="0" To="150" Duration="0:0:5" />
            <DoubleAnimation Storyboard.TargetProperty="Height" From="0" To="100" Duration="0:0:5" />
          </Storyboard>
        </BeginStoryboard>
    </EventTrigger>
</YourControl.Triggers>
like image 193
Dominic Avatar answered Oct 25 '22 07:10

Dominic