[英]TextBox context menu prevents showing AppBar
Consider the following page: 考虑以下页面:
<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>
So, this is TextBox and bottom Application Bar. 因此,这是TextBox和底部的Application Bar。 Now, when I run this store application on desktop computer, the only way I know to activate the bar is to right-click in the window.
现在,当我在台式计算机上运行此商店应用程序时,我知道激活该栏的唯一方法是右键单击窗口。 However, TextBox built-in context menu is shown, preventing the bar activation.
但是,显示了TextBox内置的上下文菜单,阻止了栏的激活。 Only when the program just starts, and no actions are done in the TextBox, application bar can be activated by right-click.
仅当程序刚刚启动且在TextBox中未执行任何操作时,才能通过右键单击激活应用程序栏。
Is there any way to show application bar in such situation? 在这种情况下有什么方法可以显示应用程序栏?
You can use ContextMenuOpening
event of TextBox
. 您可以使用
TextBox
ContextMenuOpening
事件。 Open bottom bar in that event. 在这种情况下,打开底栏。
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.