AddDeleteThemeTransition class

Applies to Windows and Windows Phone

Provides the animated transition behavior for when controls add or delete children of a panel. For example, if you have a collection of photos displayed in a Grid, you can associate this animation to the Grid so that when photos are added or deleted, the photos will animate in and out of view.

Inheritance

Object
  DependencyObject
    Transition
      AddDeleteThemeTransition

Syntax


public sealed class AddDeleteThemeTransition : Transition


<AddDeleteThemeTransition .../>

Attributes

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]
[WebHostHidden()]

Members

The AddDeleteThemeTransition class has these types of members:

Constructors

The AddDeleteThemeTransition class has these constructors.

ConstructorDescription
AddDeleteThemeTransition Initializes a new instance of the AddDeleteThemeTransition class.

 

Methods

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

MethodDescription
ClearValue Clears the local value of a dependency property. (Inherited from DependencyObject)
GetAnimationBaseValue Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject)
GetValue Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject)
ReadLocalValue Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject)
SetValue Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject)

 

Properties

The AddDeleteThemeTransition class has these properties.

PropertyAccess typeDescription

Dispatcher

Read-onlyGets the CoreDispatcher that this object is associated with. (Inherited from DependencyObject)

 

Examples

The following example shows how to use the AddDeleteThemeTransition to animate rectangles as they are added and deleted from a panel. Notice how the other child elements of the panel re-flow when one of them is removed.


<Button Content="Add Rectangle" Click="AddButton_Click"/>
<Button Content="Remove Rectangle" Click="RemoveButton_Click"/>


<ItemsControl Grid.Row="1" x:Name="rectangleItems">
    <ItemsControl.ItemContainerTransitions>
        <TransitionCollection>

            <!-- You use AddDeleteThemeTransition 
                 in panels like in a WrapGrid. -->
            <AddDeleteThemeTransition/>
        </TransitionCollection>
    </ItemsControl.ItemContainerTransitions>
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <WrapGrid Height="400"/>
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>

</ItemsControl>



private void RemoveButton_Click(object sender, RoutedEventArgs e)
{
    if (rectangleItems.Items.Count > 0)
        rectangleItems.Items.RemoveAt(0);
}

private void AddButton_Click(object sender, RoutedEventArgs e)
{
    Color rectColor = new Color();
    rectColor.R = 200;
    rectColor.A = 250;
    Rectangle myRectangle = new Rectangle();
    myRectangle.Fill = new SolidColorBrush(rectColor);
    myRectangle.Width = 100;
    myRectangle.Height = 100;
    myRectangle.Margin = new Thickness(10);
    rectangleItems.Items.Add(myRectangle);

}


Requirements

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]

Namespace

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

Metadata

Windows.winmd

See also

Transition
Animating list additions and deletions
Guidelines and checklist for add and delete animations

 

 

Show:
© 2014 Microsoft