Transition​Collection Transition​Collection Transition​Collection 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, IVectorpublic sealed class TransitionCollection : IEnumerable, IListPublic NotInheritable Class TransitionCollection Implements IEnumerable, IList
<TransitionCollection>
    oneOrMoreTransitions
</TransitionCollection>
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

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.

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>

Constructors

TransitionCollection() TransitionCollection() TransitionCollection()

Initializes a new instance of the TransitionCollection class.

public TransitionCollection()public TransitionCollection()Public Sub New()
Attributes

Properties

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

Gets or sets the element at the specified index.

This member is not implemented in C++T this[int index] { get; set; }Property Item(index As Integer) As T
Parameters
index
System.Int32 System.Int32 System.Int32

The zero-based index of the element to get or set.

Value
T T T

The element at the specified index.

Attributes
See Also
System.Collections.Generic.ICollection<T>.IsReadOnlySystem.Collections.Generic.ICollection<T>.IsReadOnlySystem.Collections.Generic.ICollection<T>.IsReadOnly

Size Size Size

Gets the size (count) of the collection.

public uint Size { get; }This member is not implemented in C#This member is not implemented in VB.Net
Value
uint uint uint

The count of items in the collection.

Attributes

Methods

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

Adds a new item to the collection.

public void Append(Transition value)This member is not implemented in C#This member is not implemented in VB.Net
Parameters
value
Transition Transition Transition

The new item to add.

Attributes

Clear() Clear() Clear()

Removes all items from the collection.

public void Clear()This member is not implemented in C#This member is not implemented in VB.Net
Attributes

First() First() First()

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

public IIterator<Transition> First()This member is not implemented in C#This member is not implemented in VB.Net
Returns

The iterator object. The iterator's current position is at the 0-index position, or at the collection end if the collection is empty.

Attributes

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

Returns the item located at the specified index.

public Transition GetAt(UInt32 index)This member is not implemented in C#This member is not implemented in VB.Net
Parameters
index
System.UInt32 System.UInt32 System.UInt32

The integer index for the value to retrieve.

Returns

The Transition value at the specified index.

Attributes

GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that iterates through the collection.

This member is not implemented in C++IEnumerator<T> GetEnumerator()Function GetEnumerator As IEnumerator(Of T)
Returns
System.Collections.Generic.IEnumerator<T> System.Collections.Generic.IEnumerator<T> System.Collections.Generic.IEnumerator<T>

An enumerator that can be used to iterate through the collection.

Attributes
See Also
System.Collections.Generic.IEnumerator<T>System.Collections.Generic.IEnumerator<T>System.Collections.Generic.IEnumerator<T>

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

Retrieves multiple elements in a single pass through the iterator.

public uint GetMany(UInt32 startIndex, Transition[] items)This member is not implemented in C#This member is not implemented in VB.Net
Parameters
startIndex
System.UInt32 System.UInt32 System.UInt32

The index from which to start retrieval.

items
Windows.UI.Xaml.Media.Animation.Transition[] Windows.UI.Xaml.Media.Animation.Transition[] Windows.UI.Xaml.Media.Animation.Transition[]

Provides the destination for the result. Size the initial array size as a capacity in order to specify how many results should be retrieved.

Returns
uint uint uint

The number of items retrieved.

Attributes

GetView() GetView() GetView()

Gets an immutable view into the collection.

public IVectorView<Transition> GetView()This member is not implemented in C#This member is not implemented in VB.Net
Returns

An object representing the immutable collection view.

Attributes

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

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

This member is not implemented in C++int IndexOf(T item)Function IndexOf(item As T) As Integer
Parameters
item
T T T

The object to locate in the System.Collections.Generic.IList`1.

Returns
System.Int32 System.Int32 System.Int32

The index of item if found in the list; otherwise, -1.

Attributes

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

Retrieves the index of the specified item.

public bool IndexOf(Transition value, UInt32 index)This member is not implemented in C#This member is not implemented in VB.Net
Parameters
value
Transition Transition Transition

The value to find in the collection.

index
System.UInt32 System.UInt32 System.UInt32

The index of the item to find, if found.

Returns
bool bool bool

true if an item with the specified value was found; otherwise, false.

Attributes

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

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

This member is not implemented in C++void Insert(int index, T item)Sub Insert(index As Integer, item As T)
Parameters
index
System.Int32 System.Int32 System.Int32

The zero-based index at which item should be inserted.

item
T T T

The object to insert into the System.Collections.Generic.IList`1.

Attributes
See Also
System.Collections.Generic.ICollection<T>.IsReadOnlySystem.Collections.Generic.ICollection<T>.IsReadOnlySystem.Collections.Generic.ICollection<T>.IsReadOnly

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

Inserts the specified item at the specified index.

public void InsertAt(UInt32 index, Transition value)This member is not implemented in C#This member is not implemented in VB.Net
Parameters
index
System.UInt32 System.UInt32 System.UInt32

The index at which to set the value.

value
Transition Transition Transition

The value to set.

Attributes

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

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

This member is not implemented in C++void RemoveAt(int index)Sub RemoveAt(index As Integer)
Parameters
index
System.Int32 System.Int32 System.Int32

The zero-based index of the item to remove.

Attributes
See Also
System.Collections.Generic.ICollection<T>.IsReadOnlySystem.Collections.Generic.ICollection<T>.IsReadOnlySystem.Collections.Generic.ICollection<T>.IsReadOnly

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

Removes the item at the specified index.

public void RemoveAt(UInt32 index)This member is not implemented in C#This member is not implemented in VB.Net
Parameters
index
System.UInt32 System.UInt32 System.UInt32

The index position of the item to remove.

Attributes

RemoveAtEnd() RemoveAtEnd() RemoveAtEnd()

Removes the last item in the collection.

public void RemoveAtEnd()This member is not implemented in C#This member is not implemented in VB.Net
Attributes

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

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

public void ReplaceAll(Transition[] items)This member is not implemented in C#This member is not implemented in VB.Net
Parameters
items
Windows.UI.Xaml.Media.Animation.Transition[] Windows.UI.Xaml.Media.Animation.Transition[] Windows.UI.Xaml.Media.Animation.Transition[]

The new collection items.

Attributes

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

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

public void SetAt(UInt32 index, Transition value)This member is not implemented in C#This member is not implemented in VB.Net
Parameters
index
System.UInt32 System.UInt32 System.UInt32

The index at which to set the value.

value
Transition Transition Transition

The value to set.

Attributes

See Also