DragItemThemeAnimation DragItemThemeAnimation DragItemThemeAnimation DragItemThemeAnimation Class

Definition

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 .../>
Inheritance
DragItemThemeAnimationDragItemThemeAnimationDragItemThemeAnimationDragItemThemeAnimation
Attributes
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

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()// This API is not available in Javascript.
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// This API is not available in Javascript.
<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// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the TargetName dependency property.

See Also

See Also