Windows phone 8.1 如何在文本框菜单处于编辑模式时禁用它

Windows phone 8.1 如何在文本框菜单处于编辑模式时禁用它,windows-phone-8.1,Windows Phone 8.1,我正在windows phone上开发一个应用程序 我有一个文本框的菜单。当TextBox处于编辑模式时,如何禁用MenuFlyout? i、 当用户点击它并且键盘启动时? 当用户在键盘关闭时完成编辑后重新启用 这是我的xaml代码: <TextBox x:Name="ListItem" Holding="OnHolding"> <FlyoutBase.AttachedFlyout>

我正在windows phone上开发一个应用程序

我有一个文本框的菜单。当TextBox处于编辑模式时,如何禁用MenuFlyout? i、 当用户点击它并且键盘启动时? 当用户在键盘关闭时完成编辑后重新启用

这是我的xaml代码:

<TextBox x:Name="ListItem" Holding="OnHolding">   
                            <FlyoutBase.AttachedFlyout>
                                <MenuFlyout>
                                    <MenuFlyoutItem x:Uid="DeleteListItemMenuItem"
                                                Command="{Binding MenuCommand}"
                                                CommandParameter="{Binding}" />
                                </MenuFlyout>
                            </FlyoutBase.AttachedFlyout>
                        </TextBox>

对我来说,有效的方法是在像这样启动弹出按钮之前检查焦点状态

私有无效文本框\保存对象发送方,保存路由目标e { 如果e.HoldingState==Windows.UI.Input.HoldingState.Completed { TextBox tb=发送方作为TextBox; 如果tb.FocusState==Windows.UI.Xaml.FocusState.Unfocused { FlyoutBase.ShowAttachedFlyoutFrameworkElementsender; } } }
如果文本框处于编辑模式,它的焦点状态为Windows.UI.Xaml.FocusState.Pointer

请显示一些代码。我对你是如何做到这一点很感兴趣。我对FlyoutBase.AttachedFlyout的处理方式没有任何问题。
 private void OnListItemHolding(object sender, HoldingRoutedEventArgs args)
        {
            TextBox textBox = sender as TextBox;
            if (textBox == null) return;

            // this event is fired multiple times. We do not want to show the menu twice
            if (args.HoldingState != HoldingState.Started) {
                return;
            }


            // If the menu was attached properly, we just need to call this handy method
            FlyoutBase.ShowAttachedFlyout(textBox );
        }