私はあなたのコントロールに適用できる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
あなたは私がUWPにスワイプジェスチャーを実装するためにあなたを助けることができるよりも、あなたが提供リンクし、その具体的な例で作業したくない場合は、私はすでに操作方法を通じてUWPアプリの私の1に実装され、それがありますあなたが欲しいのはあなただけのuwpコミュニティツールキットを使うこともできます。スワイプまたはスワイプで削除する –
スワイプ@ShubhamSahu –
最小要件10.0.10240をvs 2015と回答しましたので、何も更新する必要はありません。 –