DragItemThemeAnimation DragItemThemeAnimation DragItemThemeAnimation DragItemThemeAnimation Class

Definition

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

public : sealed class DragItemThemeAnimation : Timeline, IDragItemThemeAnimation
public sealed class DragItemThemeAnimation : Timeline, IDragItemThemeAnimation
Public NotInheritable Class DragItemThemeAnimation Inherits Timeline Implements IDragItemThemeAnimation
var dragItemThemeAnimation = new dragItemThemeAnimation();
<DragItemThemeAnimation .../>
Inheritance
DragItemThemeAnimationDragItemThemeAnimationDragItemThemeAnimationDragItemThemeAnimation
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Examples

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">
    <Grid>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="DragStates">
                <VisualState x:Name="NotDragging"/>
                <VisualState x:Name="Dragging">
                    <Storyboard>
                        <DragItemThemeAnimation TargetName="contentRectangle"/>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Rectangle x:Name="contentRectangle" 
            Width="100" 
            Height="100" 
            Fill="{TemplateBinding Background}" 
 />
    </Grid>
</ControlTemplate>
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
{
public:
    DraggableControl();
protected:
    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:
DraggableControl::DraggableControl()
{
    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
}

Remarks

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

Constructors

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

Initializes a new instance of the DragItemThemeAnimation class.

public : DragItemThemeAnimation()
public DragItemThemeAnimation()
Public Sub New()
var dragItemThemeAnimation = new dragItemThemeAnimation();
See Also

Properties

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
var string = dragItemThemeAnimation.targetName;
dragItemThemeAnimation.targetName = string;
<DragItemThemeAnimation TargetName="nameString" />

Value
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
var dependencyProperty = Windows.UI.Xaml.Media.Animation.DragItemThemeAnimation.targetNameProperty;
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the TargetName dependency property.

See Also

AllowDependentAnimations AllowDependentAnimations AllowDependentAnimations AllowDependentAnimations

Inherited from Timeline

AutoReverse AutoReverse AutoReverse AutoReverse

Inherited from Timeline

AutoReverseProperty AutoReverseProperty AutoReverseProperty AutoReverseProperty

Inherited from Timeline

BeginTime BeginTime BeginTime BeginTime

Inherited from Timeline

BeginTimeProperty BeginTimeProperty BeginTimeProperty BeginTimeProperty

Inherited from Timeline

Dispatcher Dispatcher Dispatcher Dispatcher

Inherited from DependencyObject

Duration Duration Duration Duration

Inherited from Timeline

DurationProperty DurationProperty DurationProperty DurationProperty

Inherited from Timeline

FillBehavior FillBehavior FillBehavior FillBehavior

Inherited from Timeline

FillBehaviorProperty FillBehaviorProperty FillBehaviorProperty FillBehaviorProperty

Inherited from Timeline

RepeatBehavior RepeatBehavior RepeatBehavior RepeatBehavior

Inherited from Timeline

RepeatBehaviorProperty RepeatBehaviorProperty RepeatBehaviorProperty RepeatBehaviorProperty

Inherited from Timeline

SpeedRatio SpeedRatio SpeedRatio SpeedRatio

Inherited from Timeline

SpeedRatioProperty SpeedRatioProperty SpeedRatioProperty SpeedRatioProperty

Inherited from Timeline

Methods

ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty)

Inherited from DependencyObject

GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty)

Inherited from DependencyObject

GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty)

Inherited from DependencyObject

ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty)

Inherited from DependencyObject

RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)

Inherited from DependencyObject

SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object)

Inherited from DependencyObject

UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64)

Inherited from DependencyObject

Events

Completed Completed Completed Completed

Inherited from Timeline

See Also