[英]WP8.1 AppBar size change
How do I monitor AppBar's size changes? 如何监控AppBar的大小变化? 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.
有一个SizeChanged事件,但仅在屏幕上显示AppBar之前触发。
CommandBar has Opened and Closed events. CommandBar具有Open和Closed事件。 They are fired when SecondayCommands are shown/hidden.
当显示/隐藏SecondayCommands时将触发它们。
Note that those events will be fired only if you have SecondayCommands in your AppBar. 请注意, 只有在AppBar中具有SecondayCommands时 ,才会触发这些事件。
As I've checked - Opening/Closing your AppBar doesn't change its ActualHeight. 正如我已经检查过的-打开/关闭您的AppBar不会更改其ActualHeight。 If you want to see its size changing you can play with ClosedDisplayMode - for example put this code in your
AppBarButton.Click
: 如果要查看其大小变化,可以使用ClosedDisplayMode播放-例如,将此代码放入
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. 上面的代码更改了ActualHeight ,因此引发了SizeChanged事件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.