我一個下面的XAML:XAML WP8.1 AppBarButton保持事件
<Page.BottomAppBar>
<CommandBar>
<AppBarButton Label="- запись -" Icon="Microphone" Holding="AppBarButton_Holding" PointerPressed="AppBarButton_PointerPressed" PointerReleased="AppBarButton_PointerReleased" />
<AppBarButton Label="обновить" Icon="Refresh" Click="AppBarButton_Click" />
<CommandBar.SecondaryCommands>
<AppBarButton Label="выйти" Click="AppBarButton_Click_1"/>
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
,所以我試圖趕上Holding
事件(或以某種方式瞭解該按鈕被竊聽然後被釋放)在AppBarButton:
private void AppBarButton_Holding(object sender, HoldingRoutedEventArgs e)
{
string holdingState = (e.HoldingState == Windows.UI.Input.HoldingState.Started) ? "Holding" : "Held";
Debug.WriteLine(holdingState);
}
private void AppBarButton_PointerPressed(object sender, PointerRoutedEventArgs e)
{
Debug.WriteLine("pressed!");
}
private void AppBarButton_PointerReleased(object sender, PointerRoutedEventArgs e)
{
Debug.WriteLine("released!");
}
但我不進入這些處理程序,這是奇怪,我的任何 ...
這個文檔是歸仁等奇怪: https://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.controls.appbarbutton.aspx
控股當否則未處理保持相互作用移到該元件的命中測試區域中發生 時發生。 (繼承自UIElement)
我發現了一個類似的quiestion,但看起來像有它沒有回答: WP8.1 AppBarButton holding event