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. 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. Only when the program just starts, and no actions are done in the TextBox, application bar can be activated by right-click.
Is there any way to show application bar in such situation?
You can use ContextMenuOpening
event of TextBox
. 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.
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.