请考虑以下页面:
<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和底部应用程序栏。现在,当我在台式计算机上运行此商店应用程序时,我知道激活该栏的唯一方法是在窗口中单击鼠标右键。但是,会显示TextBox内置上下文菜单,以防止栏激活。只有当程序刚刚启动,并且TextBox中没有进行任何操作时,才能通过右键单击激活应用程序栏。
有没有办法在这种情况下显示应用栏?
答案 0 :(得分:1)
您可以使用ContextMenuOpening
TextBox
事件。在那个事件中打开底栏。
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.
}