Effect on WPF window opening

Asked

Viewed 125 times

2

I would like to create an effect on the opening of my WPF window, similar to the opening of Windows 10 Weather and Mail windows.

When I open the window, Background gets a color and an image, then it all disappears, and the window is displayed Normally: inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

Does anyone know of any tutorial, tip or page that explains how to use this feature?

1 answer

0


Hello, the animation you want can be created from the following structure:

<Grid x:Name="Background">
        <Grid.Triggers>
            <EventTrigger RoutedEvent="Grid.Loaded">
                <BeginStoryboard>
                    <Storyboard>
                        <ThicknessAnimation Storyboard.TargetProperty="item1" From="item2" To="item3" DecelerationRatio="0.9" Duration="0:0:0.5"/>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>

Explaining Better

Within your control (in the case of the grid), you add the container Triggers (trigger) that will trigger your event, then set Eventtrigger as event container and Beginstoryboard to explore what happens at the beginning of the event and Routedevent receives the name of the animation target control and its trigger, the structure can change depending on the animation you want.

item1 is the target property, where animation will be applied.

item2 the initial value of this property.

item3 the final value of this property.

Duration is the duration of the animation, in the above example is 1/2 second.

for more details: https://www.codeproject.com/Articles/364529/Animation-using-Storyboards-in-WPF https://msdn.microsoft.com/pt-br/library/ms742868(v=vs.110). aspx

source: https://msdn.microsoft.com/pt-br/library/ms742868(v=vs.110). aspx

Browser other questions tagged

You are not signed in. Login or sign up in order to post.