[英]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.