TransitionCollection Class
Definition
Represents a collection of Transition objects. Each Transition object represents a different theme transition, part of the Windows Runtime animation library.
Equivalent WinUI class: Microsoft.UI.Xaml.Media.Animation.TransitionCollection.
public ref class TransitionCollection sealed : IIterable<Transition ^>, IVector<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.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.WebHostHidden]
class TransitionCollection final : IIterable<Transition>, IVector<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")]
class TransitionCollection final : IIterable<Transition>, IVector<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.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.WebHostHidden]
public sealed class TransitionCollection : IEnumerable<Transition>, IList<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")]
public sealed class TransitionCollection : IEnumerable<Transition>, IList<Transition>
Public NotInheritable Class TransitionCollection
Implements IEnumerable(Of Transition), IList(Of Transition)
<TransitionCollection>
oneOrMoreTransitions
</TransitionCollection>
- Inheritance
-
TransitionCollection
- Attributes
- Implements
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 the XAML syntax for setting a TransitionCollection object element as part of setting the UIElement.Transitions property inline.
<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>
<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>
Remarks
TransitionCollection is used as the value type for these properties:
- Border.ChildTransitions
- ContentControl.ContentTransitions (on content controls such as Button or AppBar)
- ContentPresenter.ContentTransitions
- ItemsControl.ItemContainerTransitions (on items controls such as GridView, ListBox, ListView and Selector )
- ItemsPresenter.FooterTransitions
- ItemsPresenter.HeaderTransitions
- ListViewBase.FooterTransitions
- ListViewBase.HeaderTransitions
- Panel.ChildrenTransitions (on Grid, StackPanel and other panels)
- Popup.ChildTransitions
- SettingsFlyoutTemplateSettings.ContentTransitions
- UIElement.Transitions (on hundreds of classes)
Note
Prior to Windows 10, version 1809 (SDK 17763), the XAML syntax for properties that have a TransitionCollection value requires that you declare an explicit TransitionCollection object element as the value, and then provide object elements as child elements of TransitionCollection for each of the transition animations you want to use. In Windows 10, version 1809 (SDK 17763) or later, TransitionCollection supports the implicit collection usage, so you can omit the collection object element. For more info on implicit collections and XAML, see XAML syntax guide.
Transition animations are preconfigured animations from the Windows Runtime animation library. Transition animations run automatically upon the conditions that the transition animation is associated with, using the property owner where the TransitionCollection is set as the target. The properties being animated vary depending on which transition you use.
VisualStateGroup.Transitions does not use the TransitionCollection type. VisualStateGroup.Transitions uses a built-in collection(list or vector) of VisualTransition objects.
Enumerating the collection in C# or Microsoft Visual Basic
A TransitionCollection is enumerable, so you can use language-specific syntax such as foreach in C# to enumerate the items in the collection. The compiler does the type-casting for you and you won't need to cast to IEnumerable<Transition>
explicitly. If you do need to cast explicitly, for example if you want to call GetEnumerator, cast to IEnumerable with a Transition constraint.
Constructors
TransitionCollection() |
Initializes a new instance of the TransitionCollection class. Equivalent WinUI constructor: Microsoft.UI.Xaml.Media.Animation.TransitionCollection.TransitionCollection. |
Properties
Size |
Gets the size (count) of the collection. Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.TransitionCollection.Size. |