汉堡菜单和应用程序栏

时间:2017-07-04 14:22:58

标签: layout uwp uwp-xaml

我希望实现与Groove应用程序相同的布局,其中汉堡包菜单位于左侧,appbar位于底部。但是,并非所有页面都包含appbar。

我有一个名为MainFrame的用户控件,其中包含汉堡包菜单和导航框架。

当页面加载到导航框架中时,AppBar会覆盖HamburgerMenu 。我可以忽略HamburgerMenu,但并非所有页面都包含AppBar,或者AppBar的高度不同。

是否可以在appbar上显示汉堡包?或者您有其他想法吗?

enter image description here

1 个答案:

答案 0 :(得分:0)

  1. 使用CommandBar代替Page.BottomAppBar。此外,这是微软推荐的UWP方式。
  2.   

    只有在升级Universal时才应使用AppBar   使用AppBar的Windows 8应用程序,需要尽量减少更改。对于   Windows 10中的新应用程序,我们建议使用CommandBar控件   代替。

    1. HamburgerMenu
    2. 的内容CommandBar中设置Grid

      以下是示例代码:

      <controls:HamburgerMenu>
          <!--  Items  -->
          <controls:HamburgerMenu.ItemsSource>
          </controls:HamburgerMenu.ItemsSource>
          <!--  Options  -->
          <controls:HamburgerMenu.OptionsItemsSource>
          </controls:HamburgerMenu.OptionsItemsSource>
          <!--  Content  -->
          <Grid x:Name="ContentGrid">
              <Frame Name="MainFrame"/>
              <CommandBar VerticalAlignment="Bottom"/>
          </Grid>
      </controls:HamburgerMenu>