TransitionCollection TransitionCollection TransitionCollection TransitionCollection Class

Definition

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 : IIterable<Transition>, IVector<Transition>
struct winrt::Windows::UI::Xaml::Media::Animation::TransitionCollection : IIterable<Transition>, IVector<Transition>
public sealed class TransitionCollection : IEnumerable<Transition>, IList<Transition>
Public NotInheritable Class TransitionCollection Implements IEnumerable<Transition>, IList<Transition>
<TransitionCollection>
    oneOrMoreTransitions
</TransitionCollection>
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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:

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() TransitionCollection() TransitionCollection() TransitionCollection()

Initializes a new instance of the TransitionCollection class.

Properties

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

Gets or sets the element at the specified index.

Size Size Size Size

Gets the size (count) of the collection.

Methods

Append(Transition) Append(Transition) Append(Transition) Append(Transition)

Adds a new item to the collection.

Clear() Clear() Clear() Clear()

Removes all items from the collection.

First() First() First() First()

Returns the iterator for iteration over the items in the collection.

GetAt(UInt32) GetAt(UInt32) GetAt(UInt32) GetAt(UInt32)

Returns the item located at the specified index.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that iterates through the collection.

GetMany(UInt32, Transition[]) GetMany(UInt32, Transition[]) GetMany(UInt32, Transition[]) GetMany(UInt32, Transition[])

Retrieves multiple elements in a single pass through the iterator.

GetView() GetView() GetView() GetView()

Gets an immutable view into the collection.

IndexOf(T) IndexOf(T) IndexOf(T) IndexOf(T)

Determines the index of a specific item in the System.Collections.Generic.IList`1.

IndexOf(Transition, UInt32) IndexOf(Transition, UInt32) IndexOf(Transition, UInt32) IndexOf(Transition, UInt32)

Retrieves the index of the specified item.

Insert(Int32, T) Insert(Int32, T) Insert(Int32, T) Insert(Int32, T)

Inserts an item to the System.Collections.Generic.IList`1 at the specified index.

InsertAt(UInt32, Transition) InsertAt(UInt32, Transition) InsertAt(UInt32, Transition) InsertAt(UInt32, Transition)

Inserts the specified item at the specified index.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

Removes the System.Collections.Generic.IList`1 item at the specified index.

RemoveAt(UInt32) RemoveAt(UInt32) RemoveAt(UInt32) RemoveAt(UInt32)

Removes the item at the specified index.

RemoveAtEnd() RemoveAtEnd() RemoveAtEnd() RemoveAtEnd()

Removes the last item in the collection.

ReplaceAll(Transition[]) ReplaceAll(Transition[]) ReplaceAll(Transition[]) ReplaceAll(Transition[])

Initially clears the collection, then inserts the provided array as new items.

SetAt(UInt32, Transition) SetAt(UInt32, Transition) SetAt(UInt32, Transition) SetAt(UInt32, Transition)

Sets the value at the specified index to the Transition value specified.

See also