1
我正在開發Windows Phone上的應用程序。如何在編輯模式下禁用TextBox MenuFlyout
我有一個文本框的MenuFlyout。如何在TextBox處於編輯模式時禁用MenuFlyout? (即用戶點擊它並且鍵盤已啓動)? 當用戶完成編輯時(當鍵盤關閉時)重新啓用它。
這是我的XAML代碼:
<TextBox x:Name="ListItem" Holding="OnHolding">
<FlyoutBase.AttachedFlyout>
<MenuFlyout>
<MenuFlyoutItem x:Uid="DeleteListItemMenuItem"
Command="{Binding MenuCommand}"
CommandParameter="{Binding}" />
</MenuFlyout>
</FlyoutBase.AttachedFlyout>
</TextBox>
這是我的代碼背後:
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);
}
顯示一些代碼,請。感興趣的是你如何能夠管理這一點。我用'FlyoutBase.AttachedFlyout'做的方式沒有任何問題。 – 2014-11-05 05:26:29