[英]TextBox context menu prevents showing AppBar
考慮以下頁面:
<Page ... >
<Grid>
<TextBox AcceptsReturn="True" />
</Grid>
<Page.BottomAppBar>
<AppBar>
<Grid>
<StackPanel Orientation="Horizontal">
<Button Content="Test 1" />
<Button Content="Test 2" />
</StackPanel>
</Grid>
</AppBar>
</Page.BottomAppBar>
</Page>
因此,這是TextBox和底部的Application Bar。 現在,當我在台式計算機上運行此商店應用程序時,我知道激活該欄的唯一方法是右鍵單擊窗口。 但是,顯示了TextBox內置的上下文菜單,阻止了欄的激活。 僅當程序剛剛啟動且在TextBox中未執行任何操作時,才能通過右鍵單擊激活應用程序欄。
在這種情況下有什么方法可以顯示應用程序欄?
您可以使用TextBox
ContextMenuOpening
事件。 在這種情況下,打開底欄。
private void TextBox_ContextMenuOpening_1(object sender, ContextMenuEventArgs e)
{
BottomAppBar.IsOpen = true;
e.Handled = true; //True only if you don't want to show context menu of textbox.
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.