How do I monitor AppBar's size changes? Specifically, I want to know when it gets opened(to show secondary commands and labels underneath icons). There is a SizeChanged event, but it fires only before AppBar is shown on the screen.
CommandBar has Opened and Closed events. They are fired when SecondayCommands are shown/hidden.
Note that those events will be fired only if you have SecondayCommands in your AppBar.
As I've checked - Opening/Closing your AppBar doesn't change its ActualHeight. If you want to see its size changing you can play with ClosedDisplayMode - for example put this code in your AppBarButton.Click
:
private void AppBarToggleButton_Click(object sender, RoutedEventArgs e)
{
Debug.WriteLine(BottomAppBar.ActualHeight.ToString());
if (BottomAppBar.ClosedDisplayMode == AppBarClosedDisplayMode.Compact)
BottomAppBar.ClosedDisplayMode = AppBarClosedDisplayMode.Minimal;
else BottomAppBar.ClosedDisplayMode = AppBarClosedDisplayMode.Compact;
}
The code above changes ActualHeight and thus SizeChanged event is being fired.
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.