我有以下代碼:手柄向上輕掃,可向下滑動,向左滑動和向右滑動,即可手勢在WinRT的應用
public MainPage()
{
this.InitializeComponent();
this.ManipulationStarting += MainPage_ManipulationStarting;
this.ManipulationStarted += MainPage_ManipulationStarted;
this.ManipulationInertiaStarting += MainPage_ManipulationInertiaStarting;
this.ManipulationDelta += MainPage_ManipulationDelta;
this.ManipulationCompleted += MainPage_ManipulationCompleted;
}
void MainPage_ManipulationStarting(object sender, ManipulationStartingRoutedEventArgs e)
{
Debug.WriteLine("MainPage_ManipulationStarting");
}
void MainPage_ManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e)
{
Debug.WriteLine("MainPage_ManipulationStarted");
}
void MainPage_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e)
{
Debug.WriteLine("MainPage_ManipulationInertiaStarting");
}
void MainPage_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
Debug.WriteLine("MainPage_ManipulationDelta");
}
void MainPage_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
{
Debug.WriteLine("MainPage_ManipulationCompleted");
}
但我對如何使用操作事件不知道。你可以描述如何處理手勢向上,向下,向左或向右滑動嗎?
我沒有使用過WinRT手勢,但是快速瀏覽一下MSDN,我會打賭你可以在'Delta'(或其他)事件期間訪問參數的各種屬性。例如'ManipulationDeltaRoutedEventArgs.Velocities'具有一組關於來自用戶的方向/角度/標度輸入的數據。我不能說這是你應該看到的「那個」,但也許它會給你一個開始。 –