SwipeHintThemeAnimation Class

Swipe제스처를 지금 사용할 수 있음을 나타내는 미리 구성된 애니메이션을 나타냅니다.

상속

Object
  DependencyObject
    Timeline
      SwipeHintThemeAnimation

구문


public sealed class SwipeHintThemeAnimation : Timeline


<SwipeHintThemeAnimation ... />

특성

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

멤버

SwipeHintThemeAnimation클래스에는 다음과 같은 형식의 멤버가 있습니다.

생성자

SwipeHintThemeAnimation클래스에는 다음과 같은 생성자가 있습니다.

생성자Description
SwipeHintThemeAnimation Initializes a new instance of the SwipeHintThemeAnimation class.

 

이벤트

SwipeHintThemeAnimation클래스에는 다음과 같은 이벤트가 있습니다.

이벤트Description
Completed Occurs when the Storyboard object has completed playing. (다음에서 상속됨 Timeline)

 

메서드

The SwipeHintThemeAnimation 클래스 - 이러한 메서드가 있습니다. 다음 위치의 메서드도 상속합니다. Object 클래스.

메서드Description
ClearValue Clears the local value of a dependency property. (다음에서 상속됨 DependencyObject)
GetAnimationBaseValue Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (다음에서 상속됨 DependencyObject)
GetValue Returns the current effective value of a dependency property from a DependencyObject. (다음에서 상속됨 DependencyObject)
ReadLocalValue Returns the local value of a dependency property, if a local value is set. (다음에서 상속됨 DependencyObject)
SetValue Sets the local value of a dependency property on a DependencyObject. (다음에서 상속됨 DependencyObject)

 

속성

SwipeHintThemeAnimation클래스 - 이러한 속성이 있습니다.

속성사용 권한Description

AutoReverse

읽기/쓰기Gets or sets a value that indicates whether the timeline plays in reverse after it completes a forward iteration. (다음에서 상속됨 Timeline)

BeginTime

읽기/쓰기Gets or sets the time at which this Timeline should begin. (다음에서 상속됨 Timeline)

Dispatcher

읽기 전용Gets the CoreDispatcher that this object is associated with. (다음에서 상속됨 DependencyObject)

Duration

읽기/쓰기Gets or sets the length of time for which this timeline plays, not counting repetitions. (다음에서 상속됨 Timeline)

FillBehavior

읽기/쓰기Gets or sets a value that specifies how the animation behaves after it reaches the end of its active period. (다음에서 상속됨 Timeline)

RepeatBehavior

읽기/쓰기Gets or sets the repeating behavior of this timeline. (다음에서 상속됨 Timeline)

SpeedRatio

읽기/쓰기Gets or sets the rate, relative to its parent, at which time progresses for this Timeline. (다음에서 상속됨 Timeline)

TargetName

읽기/쓰기Gets or sets the reference name of the control element being targeted.

TargetNameProperty

읽기 전용Identifies the TargetName dependency property.

ToHorizontalOffset

읽기/쓰기Gets or sets the distance by which the target is translated in the horizontal direction when the animation is active.

ToHorizontalOffsetProperty

읽기 전용Identifies the ToHorizontalOffset dependency property.

ToVerticalOffset

읽기/쓰기Gets or sets the distance by which the target is translated in the vertical direction when the animation is active.

ToVerticalOffsetProperty

읽기 전용Identifies the ToVerticalOffset dependency property.

 

설명

지속 시간이 미리 구성되어 있으므로 Duration 속성을 설정해도 이 개체에는 영향을 주지 않습니다.

예제

다음은 살짝 밀기 선택을 지원하는 사용자 지정 컨트롤에 대한 템플릿 예입니다.



<!-- Example template of a custom control that supports swipe selection. 
     A SwipeHintThemeAnimation is run when the control is in the Hinting state. -->
<ControlTemplate TargetType="local:SwipeControl">
    <Grid>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="SwipeStates">                                
                <VisualState x:Name="Normal">
                    <Storyboard>
                        <SwipeBackThemeAnimation TargetName="contentRectangle" />
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="Selected">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectedText" 
                                                        Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="Hinting">
                    <Storyboard>
                        <SwipeHintThemeAnimation TargetName="contentRectangle" />
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Rectangle Width="100" Height="100" Fill="{TemplateBinding Background}" />
                        
        <Rectangle x:Name="contentRectangle"
                    Width="100" 
                    Height="100" 
                    Fill="{TemplateBinding Foreground}" />
        <TextBlock x:Name="SelectedText" 
                    Text="Selected" 
                    Visibility="Collapsed" 
                    Foreground="White" 
                    FontSize="20" 
                    VerticalAlignment="Center" 
                    HorizontalAlignment="Center"  />
    </Grid>
</ControlTemplate>
 


public sealed class SwipeControl : Control
{
    GestureRecognizer _gestureRecognizer;
    bool _isPointerDown = false;
    bool _isSelected = false;
    bool _isCrossSliding = false;

    public SwipeControl()
    {
        this.DefaultStyleKey = typeof(SwipeControl);
        // Direct gesture recognizer to recognize hold and swipe gestures.
        _gestureRecognizer = new GestureRecognizer();
        _gestureRecognizer.GestureSettings = GestureSettings.Hold | 
                                             GestureSettings.HoldWithMouse | 
                                             GestureSettings.CrossSlide;

        _gestureRecognizer.Holding += GestureRecognizer_Holding;
        _gestureRecognizer.CrossSlideHorizontally = false; // Support vertical swiping.
        _gestureRecognizer.CrossSliding += GestureRecognizer_CrossSliding;            
    }

    protected override void OnPointerPressed(PointerRoutedEventArgs e)
    {
        base.OnPointerPressed(e);
        _isPointerDown = CapturePointer(e.Pointer);
        // Send input to GestureRecognizer for processing.
        _gestureRecognizer.ProcessDownEvent(e.GetCurrentPoint(this));
            
    }

    protected override void OnPointerReleased(PointerRoutedEventArgs e)
    {
        base.OnPointerReleased(e);
        // Send input to GestureRecognizer for processing.
        _gestureRecognizer.ProcessUpEvent(e.GetCurrentPoint(this));

        _isCrossSliding = false;

        // Go to Normal state when pointer is released.
        if (!_isSelected)
        {
            VisualStateManager.GoToState(this, "Normal", true);
        }
    }

    protected override void OnPointerMoved(PointerRoutedEventArgs e)
    {
        base.OnPointerMoved(e);
        if (_isPointerDown)
        {
            // Send input to GestureRecognizer for processing.
            _gestureRecognizer.ProcessMoveEvents(e.GetIntermediatePoints(this));
        }
    }

    void GestureRecognizer_Holding(GestureRecognizer sender, HoldingEventArgs args)
    {
        // Go to Hinting state if control is not already selected.
        if (!_isSelected)
        {
            VisualStateManager.GoToState(this, "Hinting", true);
        }
    }

    void GestureRecognizer_CrossSliding(GestureRecognizer sender, CrossSlidingEventArgs args)
    {
        // Prevent multiple state changes for the same swipe gesture.
        if (!_isCrossSliding)
        {
            _isCrossSliding = true;                
                
            // Toggle between Selected and Normal on swipe gesture.
            _isSelected = !_isSelected;
            if (_isSelected)
            {
                VisualStateManager.GoToState(this, "Selected", true);
            }
            else
            {
                VisualStateManager.GoToState(this, "Normal", true);
            }
        }
           
    }
}


요구 사항

지원되는 최소 클라이언트

Windows 8 [Windows 스토어 앱만]

지원되는 최소 서버

Windows Server 2012 [Windows 스토어 앱만]

Namespace

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

Metadata

Windows.winmd

참고 항목

Timeline
살짝 밀기 제스처에 애니메이션 효과 적용
살짝 밀기 애니메이션을 위한 지침 및 검사 목록

 

 

표시:
© 2014 Microsoft