EntranceThemeTransition Class
Definition
Provides the animated transition behavior on controls when they first appear. You can use this on individual objects or on containers of objects. In the latter case, child elements will animate into view in sequence rather than all at the same time.
Equivalent WinUI class: Microsoft.UI.Xaml.Media.Animation.EntranceThemeTransition.
public ref class EntranceThemeTransition sealed : Transition
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Static(Windows.UI.Xaml.Media.Animation.IEntranceThemeTransitionStatics, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.WebHostHidden]
class EntranceThemeTransition sealed : Transition
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.WebHostHidden]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.Static(Windows.UI.Xaml.Media.Animation.IEntranceThemeTransitionStatics, 65536, "Windows.Foundation.UniversalApiContract")]
class EntranceThemeTransition sealed : Transition
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Static(typeof(Windows.UI.Xaml.Media.Animation.IEntranceThemeTransitionStatics), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.WebHostHidden]
public sealed class EntranceThemeTransition : Transition
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.WebHostHidden]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Static(typeof(Windows.UI.Xaml.Media.Animation.IEntranceThemeTransitionStatics), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class EntranceThemeTransition : Transition
Public NotInheritable Class EntranceThemeTransition
Inherits Transition
<EntranceThemeTransition .../>
- Inheritance
- Attributes
Windows 10 requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
Examples
This example shows a how to apply an EntranceThemeTransition to a Button.
<Button Content="EntranceThemeTransition Button">
<Button.Transitions>
<TransitionCollection>
<!-- This transition just uses the default behavior which is to
have the button animate into view from the right. You can
make it start from anywhere on the right by using the
FromHorizontalOffset property. If you'd rather see a vertical
animation, use the FromVerticalOffset property. -->
<EntranceThemeTransition />
</TransitionCollection>
</Button.Transitions>
</Button>
Here, the EntranceThemeTransition is applied using a Style resource.
<Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
<Grid.Resources>
<Style x:Key="DefaultButtonStyle" TargetType="Button">
<Setter Property="Transitions">
<Setter.Value>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<Button Style="{StaticResource DefaultButtonStyle}"
Content="EntranceThemeTransition style applied" />
</Grid>
If you set an EntranceThemeTransition animation on a panel, the children of the panel will automatically offset when they animate into view to create a visually appealing entrance.
Here, as rectangles are added to the StackPanel, they fly in from the upper right, rather than just appearing in place.
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Button Content="Add rectangle" Click="Button_Click"/>
<StackPanel x:Name="panel1" HorizontalAlignment="Left" Margin="200">
<StackPanel.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition
FromHorizontalOffset="200"
FromVerticalOffset="-200"/>
</TransitionCollection>
</StackPanel.ChildrenTransitions>
</StackPanel>
</Grid>
private void Button_Click(object sender, RoutedEventArgs e)
{
// Add a rectangle to the StackPanel.
Rectangle r = new Rectangle();
r.Width = 100;
r.Height = 100;
// Alternate colors as rectangles are added.
if (panel1.Children.Count % 2 == 0)
{
r.Fill = new SolidColorBrush(Colors.Green);
}
else
{
r.Fill = new SolidColorBrush(Colors.Yellow);
}
panel1.Children.Add(r);
}
Constructors
EntranceThemeTransition() |
Initializes a new instance of the EntranceThemeTransition class. Equivalent WinUI constructor: Microsoft.UI.Xaml.Media.Animation.EntranceThemeTransition.EntranceThemeTransition. |
Properties
Dispatcher |
Gets the CoreDispatcher that this object is associated with. The CoreDispatcher represents a facility that can access the DependencyObject on the UI thread even if the code is initiated by a non-UI thread. Equivalent WinUI property: Microsoft.UI.Xaml.DependencyObject.Dispatcher. (Inherited from DependencyObject) |
FromHorizontalOffset |
Gets or sets the distance by which the target is translated in the horizontal direction when the animation is active. Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.EntranceThemeTransition.FromHorizontalOffset. |
FromHorizontalOffsetProperty |
Identifies the FromHorizontalOffset dependency property. Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.EntranceThemeTransition.FromHorizontalOffsetProperty. |
FromVerticalOffset |
Gets or sets the distance by which the target is translated in the vertical direction when the animation is active. Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.EntranceThemeTransition.FromVerticalOffset. |
FromVerticalOffsetProperty |
Identifies the FromVerticalOffset dependency property. Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.EntranceThemeTransition.FromVerticalOffsetProperty. |
IsStaggeringEnabled |
Gets or sets a value that determines whether the transition staggers rendering of multiple items, or renders all items at once. Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.EntranceThemeTransition.IsStaggeringEnabled. |
IsStaggeringEnabledProperty |
Identifies the IsStaggeringEnabled dependency property. Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.EntranceThemeTransition.IsStaggeringEnabledProperty. |