TransitionCollection TransitionCollection TransitionCollection Class

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

Syntax

Declaration

public sealed class TransitionCollectionpublic sealed class TransitionCollectionPublic NotInheritable Class TransitionCollection
<TransitionCollection>
    oneOrMoreTransitions
</TransitionCollection>

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.

Transitions does not use the TransitionCollection type. 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 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 summary

Initializes a new instance of the TransitionCollection class.

Properties summary

Gets the size (count) of the collection.

Methods summary

Adds a new item to the collection.

Removes all items from the collection.

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

Returns the item located at the specified index.

Retrieves multiple elements in a single pass through the iterator.

Gets an immutable view into the collection.

Retrieves the index of the specified item.

Inserts the specified item at the specified index.

Removes the item at the specified index.

Removes the last item in the collection.

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

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

Constructors

  • TransitionCollection()
    TransitionCollection()
    TransitionCollection()
    TransitionCollection()

    Initializes a new instance of the TransitionCollection class.

    public TransitionCollection()public TransitionCollection()Public Function TransitionCollection() As

Properties

  • Size
    Size
    Size
    Size

    Gets the size (count) of the collection.

    public uint Size { get; }public uint Size { get; }Public ReadOnly Property Size As uint

    Property Value

    • uint
      uint
      uint

      The count of items in the collection.

Methods

  • Append(Windows.UI.Xaml.Media.Animation.Transition)
    Append(Windows.UI.Xaml.Media.Animation.Transition)
    Append(Windows.UI.Xaml.Media.Animation.Transition)
    Append(Windows.UI.Xaml.Media.Animation.Transition)

    Adds a new item to the collection.

    public void Append(Windows.UI.Xaml.Media.Animation.Transition)public void Append(Windows.UI.Xaml.Media.Animation.Transition)Public Function Append(Windows.UI.Xaml.Media.Animation.Transition) As void

    Parameters

  • Clear()
    Clear()
    Clear()
    Clear()

    Removes all items from the collection.

    public void Clear()public void Clear()Public Function Clear() As void
  • First()
    First()
    First()
    First()

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

    public IIterator<Transition> First()public IIterator<Transition> First()Public Function First() As IIterator( Of Transition )

    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.

  • GetAt(System.UInt32)
    GetAt(System.UInt32)
    GetAt(System.UInt32)
    GetAt(System.UInt32)

    Returns the item located at the specified index.

    public Transition GetAt(System.UInt32)public Transition GetAt(System.UInt32)Public Function GetAt(System.UInt32) As Transition

    Parameters

    • index
      System.UInt32
      System.UInt32
      System.UInt32

      The integer index for the value to retrieve.

    Returns

  • GetMany(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition[])
    GetMany(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition[])
    GetMany(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition[])
    GetMany(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition[])

    Retrieves multiple elements in a single pass through the iterator.

    public uint GetMany(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition[])public uint GetMany(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition[])Public Function GetMany(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition[]) As uint

    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.

  • GetView()
    GetView()
    GetView()
    GetView()

    Gets an immutable view into the collection.

    public IVectorView<Transition> GetView()public IVectorView<Transition> GetView()Public Function GetView() As IVectorView( Of Transition )

    Returns

    • An object representing the immutable collection view.

  • IndexOf(Windows.UI.Xaml.Media.Animation.Transition,System.UInt32)
    IndexOf(Windows.UI.Xaml.Media.Animation.Transition,System.UInt32)
    IndexOf(Windows.UI.Xaml.Media.Animation.Transition,System.UInt32)
    IndexOf(Windows.UI.Xaml.Media.Animation.Transition,System.UInt32)

    Retrieves the index of the specified item.

    public bool IndexOf(Windows.UI.Xaml.Media.Animation.Transition,System.UInt32)public bool IndexOf(Windows.UI.Xaml.Media.Animation.Transition,System.UInt32)Public Function IndexOf(Windows.UI.Xaml.Media.Animation.Transition,System.UInt32) As bool

    Parameters

    • value

      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.

  • InsertAt(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition)
    InsertAt(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition)
    InsertAt(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition)
    InsertAt(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition)

    Inserts the specified item at the specified index.

    public void InsertAt(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition)public void InsertAt(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition)Public Function InsertAt(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition) As void

    Parameters

  • RemoveAt(System.UInt32)
    RemoveAt(System.UInt32)
    RemoveAt(System.UInt32)
    RemoveAt(System.UInt32)

    Removes the item at the specified index.

    public void RemoveAt(System.UInt32)public void RemoveAt(System.UInt32)Public Function RemoveAt(System.UInt32) As void

    Parameters

    • index
      System.UInt32
      System.UInt32
      System.UInt32

      The index position of the item to remove.

  • RemoveAtEnd()
    RemoveAtEnd()
    RemoveAtEnd()
    RemoveAtEnd()

    Removes the last item in the collection.

    public void RemoveAtEnd()public void RemoveAtEnd()Public Function RemoveAtEnd() As void
  • ReplaceAll(Windows.UI.Xaml.Media.Animation.Transition[])
    ReplaceAll(Windows.UI.Xaml.Media.Animation.Transition[])
    ReplaceAll(Windows.UI.Xaml.Media.Animation.Transition[])
    ReplaceAll(Windows.UI.Xaml.Media.Animation.Transition[])

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

    public void ReplaceAll(Windows.UI.Xaml.Media.Animation.Transition[])public void ReplaceAll(Windows.UI.Xaml.Media.Animation.Transition[])Public Function ReplaceAll(Windows.UI.Xaml.Media.Animation.Transition[]) As void

    Parameters

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

      The new collection items.

  • SetAt(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition)
    SetAt(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition)
    SetAt(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition)
    SetAt(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition)

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

    public void SetAt(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition)public void SetAt(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition)Public Function SetAt(System.UInt32,Windows.UI.Xaml.Media.Animation.Transition) As void

    Parameters

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute

Details

Assembly

Windows.UI.Xaml.Media.Animation.dll