Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# XAML WP8.1 AppBarButton保持事件_C#_Xaml_Windows Phone 8 - Fatal编程技术网

C# XAML WP8.1 AppBarButton保持事件

C# XAML WP8.1 AppBarButton保持事件,c#,xaml,windows-phone-8,C#,Xaml,Windows Phone 8,我有以下xaml: <Page.BottomAppBar> <CommandBar> <AppBarButton Label="- запись -" Icon="Microphone" Holding="AppBarButton_Holding" PointerPressed="AppBarButton_PointerPressed" PointerReleased="AppBarButton_PointerRelease

我有以下xaml:

<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>
但我没有接触到这些处理程序,这对我来说很奇怪

关于这一点的文档非常奇怪:

当发生未经处理的保持交互时发生保持 超过此元件的命中测试区域。从UIElement继承的

我发现了类似的静默,但似乎没有答案:

这些事件处理程序的存在是因为AppBarButton继承了Button。

但是!我认为微软不希望开发人员实现与应用程序栏按钮的交互。这不是正确的用户体验,你应该避免。我相信没有人会找到它

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!");
        }