TransitionCollection class
Collapse the table of content
Expand the table of content

TransitionCollection class

Represents a collection of Transition objects. Each Transition object represents a different theme transition, part of the Windows Runtime animation library.




public sealed class TransitionCollection : IList<Transition>,


XAML Values


One or more object elements instantiating types that are derived from the Transition base type. Typically there is only one of each type of transition included in the collection.


The TransitionCollection class has these types of members:


The TransitionCollection class has these constructors.

TransitionCollection Initializes a new instance of the TransitionCollection class.



The TransitionCollection class has these methods. It also inherits methods from the Object class.

Add [C#, VB]Adds a new item to the collection.
Append [C++]Adds a new item to the collection.
Clear Removes all items from the collection.
Contains [C#, VB]Determines whether an element is in the collection.
CopyTo [C#, VB]Copies the elements of the collection to an array, starting at a particular array index.
First [C++]Returns the iterator for iteration over the items in the collection.
GetAt [C++]Returns the item located at the specified index.
GetMany [C++]Retrieves multiple elements in a single pass through the iterator.
GetView [C++]Gets an immutable view into the collection.
IndexOf [C++]Retrieves the index of the specified item.
IndexOf [C#, VB]Determines the index of a specific item in the collection.
Insert [C#, VB]Inserts an item into the collection at the specified index.
InsertAt [C++]Inserts the specified item at the specified index.
Remove [C#, VB]Removes the first occurrence of a specific object from the collection.
RemoveAt [C++]Removes the item at the specified index.
RemoveAt [C#, VB]Removes the element at the specified index of the collection.
RemoveAtEnd [C++]Removes the last item in the collection.
ReplaceAll [C++]Initially clears the collection, then inserts the provided array as new items.
SetAt [C++]Sets the value at the specified index to the Transition value specified.



The TransitionCollection class has these properties.

PropertyAccess typeDescription

Count [C#, VB]


Gets the number of elements contained in the collection.

IsReadOnly [C#, VB]


Gets a value indicating whether the collection is read-only.

Item [C#, VB]


Gets or sets the element at the specified index.

Size [C++]


Gets the size (count) of the collection.



TransitionCollection is used as the value type for these properties:

Important  The XAML syntax for all properties that use a TransitionCollection value is unusual in that you must 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. For most other XAML collection properties you could omit the collection object element because it can be implicit, but properties that use TransitionCollection don't support the implicit collection usage. 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<T> with a Transition constraint.


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">
            <!-- 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 />

This example shows the XAML syntax for setting a TransitionCollection object element as part of setting the UIElement.Transitions property via a Style setter.

<Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
        <Style x:Key="DefaultButtonStyle" TargetType="Button">
            <Setter Property="Transitions">

    <Button Style="{StaticResource DefaultButtonStyle}" 
            Content="EntranceThemeTransition style applied" />


Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::UI::Xaml::Media::Animation [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]


Windows::UI::Xaml::Media::Animation [C++]





See also




© 2017 Microsoft