DragItemThemeAnimation DragItemThemeAnimation DragItemThemeAnimation DragItemThemeAnimation Class


Represents the preconfigured animation that applies to item elements being dragged.

public : sealed class DragItemThemeAnimation : Timeline, IDragItemThemeAnimationpublic sealed class DragItemThemeAnimation : Timeline, IDragItemThemeAnimationPublic NotInheritable Class DragItemThemeAnimation Inherits Timeline Implements IDragItemThemeAnimation// This API is not available in Javascript.
<DragItemThemeAnimation .../>
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited properties

Inherited methods

Inherited events


The following is an example of a drag-enabled custom control.

<!-- Example template of a drag-enabled custom control.  The 
     DragItemThemeAnimation will be run when the control
     is in the Dragging state.                     
<ControlTemplate TargetType="local:DraggableControl">
            <VisualStateGroup x:Name="DragStates">
                <VisualState x:Name="NotDragging"/>
                <VisualState x:Name="Dragging">
                        <DragItemThemeAnimation TargetName="contentRectangle"/>
        <Rectangle x:Name="contentRectangle" 
            Fill="{TemplateBinding Background}" 
public sealed class DraggableControl : Control
    public DraggableControl()
        this.DefaultStyleKey = typeof(DraggableControl);

    protected override void OnPointerPressed(PointerRoutedEventArgs e)
        // Go to the Dragging state, which will start the DragItemThemeAnimation
        VisualStateManager.GoToState(this, "Dragging", true);

    protected override void OnPointerReleased(PointerRoutedEventArgs e)
        VisualStateManager.GoToState(this, "NotDragging", true);

    protected override void OnPointerMoved(PointerRoutedEventArgs e)
        // dragging implementation here
// DraggableControl.h:
public ref class DraggableControl sealed : public Windows::UI::Xaml::Controls::Control
    virtual void OnPointerPressed(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e) override;
    virtual void OnPointerReleased(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e) override;
    virtual void OnPointerMoved(Windows::UI::Xaml::Input:: PointerRoutedEventArgs^ e) override;

// DraggableControl.cpp:
    DefaultStyleKey = "MyApp.DraggableControl";

void DraggableControl::OnPointerPressed(PointerRoutedEventArgs^ e)
    // Go to the Dragging state, which will start the DragItemThemeAnimation
    VisualStateManager::GoToState(this, "Dragging", true);

void DraggableControl::OnPointerReleased(PointerRoutedEventArgs^ e)
    VisualStateManager::GoToState(this, "NotDragging", true);

void DraggableControl::OnPointerMoved(PointerRoutedEventArgs^ e)
    // dragging implementation here


Note that setting the Duration property has no effect on this object since the duration is preconfigured.


DragItemThemeAnimation() DragItemThemeAnimation() DragItemThemeAnimation() DragItemThemeAnimation()

Initializes a new instance of the DragItemThemeAnimation class.

public : DragItemThemeAnimation()public DragItemThemeAnimation()Public Sub New()// This API is not available in Javascript.
See Also


TargetName TargetName TargetName TargetName

Gets or sets the reference name of the control element being targeted.

public : PlatForm::String TargetName { get; set; }public string TargetName { get; set; }Public ReadWrite Property TargetName As string// This API is not available in Javascript.
<DragItemThemeAnimation TargetName="nameString" />

PlatForm::String string string string

The reference name. This is typically the x:Name of the relevant element as declared in XAML.

See Also

TargetNameProperty TargetNameProperty TargetNameProperty TargetNameProperty

Identifies the TargetName dependency property.

public : static DependencyProperty TargetNameProperty { get; }public static DependencyProperty TargetNameProperty { get; }Public Static ReadOnly Property TargetNameProperty As DependencyProperty// This API is not available in Javascript.
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the TargetName dependency property.

See Also

See Also