SwipeBackThemeAnimation 클래스
TOC
콘텐츠의 테이블 축소
콘텐츠의 테이블 확장

SwipeBackThemeAnimation Class

Swipe 상호 작용 후 요소를 레이아웃 슬롯으로 밀어 넣을 때 컨트롤에 적용되는 미리 구성된 애니메이션을 나타냅니다.

상속

Object
  DependencyObject
    Timeline
      SwipeBackThemeAnimation

구문


public sealed class SwipeBackThemeAnimation : Timeline


<SwipeBackThemeAnimation ... />

특성

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

멤버

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

생성자

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

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

 

이벤트

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

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

 

메서드

The SwipeBackThemeAnimation 클래스 - 이러한 메서드가 있습니다. 다음 위치의 메서드도 상속합니다. 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)

 

속성

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

속성사용 권한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)

FromHorizontalOffset

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

FromHorizontalOffsetProperty

읽기 전용Identifies the FromHorizontalOffset dependency property.

FromVerticalOffset

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

FromVerticalOffsetProperty

읽기 전용Identifies the FromHorizontalOffset dependency property.

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.

 

설명

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

예제

다음 예제에서는 DoubleAnimationSineEase 감속/가속 함수를 적용하여 감속 애니메이션을 만듭니다.



<!-- Example template of a custom control that supports swipe selection.  
     A SwipeBackThemeAnimation is run when the control goes to the Normal 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
살짝 밀기 제스처에 애니메이션 효과 적용
살짝 밀기 애니메이션을 위한 지침 및 검사 목록

 

 

표시:
© 2016 Microsoft