Resources/XAML/ResourceDictionaries/Page.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <!-- Defining the easing function for smoother transitions --> <QuadraticEase x:Key="QuadraticEaseOut" EasingMode="EaseOut" /> <Style x:Key="Page_Style" TargetType="{x:Type UserControl}"> <Setter Property="RenderTransform"> <Setter.Value> <TranslateTransform X="0" Y="50" /> </Setter.Value> </Setter> <Setter Property="Opacity" Value="0" /> <Style.Triggers> <Trigger Property="Visibility" Value="Collapsed"> <Setter Property="Opacity" Value="0" /> </Trigger> <EventTrigger RoutedEvent="Loaded"> <BeginStoryboard> <Storyboard> <!-- Opacity Animation --> <DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="0:0:0.1" From="0" To="1" EasingFunction="{StaticResource QuadraticEaseOut}"/> <!-- Y Translation Animation --> <DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Duration="0:0:0.1" From="50" To="0" DecelerationRatio="0.2" EasingFunction="{StaticResource QuadraticEaseOut}"/> </Storyboard> </BeginStoryboard> </EventTrigger> </Style.Triggers> </Style> </ResourceDictionary> |