2017-10-26 24 views
0

最新のアップデート(Windows Fall Creators Update)にはスワイプクラスが含まれていますが、現在のVS(15.4.1)の安定版には方法がありませんそれを機能させる。私は現在、Visual Studio 2017 Enterprise(15.4.1)で最新のW10アップデート(1709)を実行しています。これを動作させる方法はありません。私は次の例がうまくいくように努力しましたが、運がありません:https://channel9.msdn.com/Events/Windows/Windows-Developer-Day-Fall-Creators-Update/WinDev015#commentsUWPでスワイプジェスチャーを使用

+0

あなたは私がUWPにスワイプジェスチャーを実装するためにあなたを助けることができるよりも、あなたが提供リンクし、その具体的な例で作業したくない場合は、私はすでに操作方法を通じてUWPアプリの私の1に実装され、それがありますあなたが欲しいのはあなただけのuwpコミュニティツールキットを使うこともできます。スワイプまたはスワイプで削除する –

+0

スワイプ@ShubhamSahu –

+0

最小要件10.0.10240をvs 2015と回答しましたので、何も更新する必要はありません。 –

答えて

1

私はあなたのコントロールに適用できるTextBlockにスワイプを適用しています。

XAML

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> 
    <TextBlock Name="SwipeableTextBlock" 
       HorizontalAlignment="Stretch" 
       VerticalAlignment="Stretch" 
       TextAlignment="Center" Text="No Swipe" 
       FontSize="65" FontWeight="Light" 
       ManipulationMode="TranslateX,TranslateInertia,System" 
       ManipulationDelta="SwipeableTextBlock_ManipulationDelta" 
       ManipulationCompleted="SwipeableTextBlock_ManipulationCompleted"/> 
</Grid> 

C#

private bool _isSwiped; 

private void SwipeableTextBlock_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e) 
{ 
    if (e.IsInertial && !_isSwiped) 
    { 
     var swipedDistance = e.Cumulative.Translation.X; 

     if (Math.Abs(swipedDistance) <= 2) return; 

     if (swipedDistance > 0) 
     { 
      SwipeableTextBlock.Text = "Right Swiped"; 
     } 
     else 
     { 
      SwipeableTextBlock.Text = "Left Swiped"; 
     } 
     _isSwiped = true; 
    }    
} 

    private void SwipeableTextBlock_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e) 
    { 
     _isSwiped = false; 
    }  

出力@JustinXL答えにクレジット(PCとモバイルの両方で動作)、これはサンプルrepository

です3210

Output

関連する問題