EntranceThemeTransition Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
public ref class EntranceThemeTransition sealed : Transition
/// [Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.WinUIContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class EntranceThemeTransition final : Transition
[Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.WinUIContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class EntranceThemeTransition : Transition
Public NotInheritable Class EntranceThemeTransition
Inherits Transition
<EntranceThemeTransition .../>
- Inheritance
- Attributes
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. |
Properties
Dispatcher |
Always returns |
DispatcherQueue |
Gets the |
FromHorizontalOffset |
Gets or sets the distance by which the target is translated in the horizontal direction when the animation is active. |
FromHorizontalOffsetProperty |
Identifies the FromHorizontalOffset dependency property. |
FromVerticalOffset |
Gets or sets the distance by which the target is translated in the vertical direction when the animation is active. |
FromVerticalOffsetProperty |
Identifies the FromVerticalOffset dependency property. |
IsStaggeringEnabled |
Gets or sets a value that determines whether the transition staggers rendering of multiple items, or renders all items at once. |
IsStaggeringEnabledProperty |
Identifies the IsStaggeringEnabled dependency property. |
Methods
ClearValue(DependencyProperty) |
Clears the local value of a dependency property. (Inherited from DependencyObject) |
GetAnimationBaseValue(DependencyProperty) |
Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject) |
GetValue(DependencyProperty) |
Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject) |
ReadLocalValue(DependencyProperty) |
Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject) |
RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback) |
Registers a notification function for listening to changes to a specific DependencyProperty on this DependencyObject instance. (Inherited from DependencyObject) |
SetValue(DependencyProperty, Object) |
Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject) |
UnregisterPropertyChangedCallback(DependencyProperty, Int64) |
Cancels a change notification that was previously registered by calling RegisterPropertyChangedCallback. (Inherited from DependencyObject) |