zoukankan      html  css  js  c++  java
  • M4: 使用CommandBar

    本小节将介绍如何使用CommandBar, CommandBar分为PrimaryCommandsSecondaryCommands,在PrimaryCommands中不要放置多于四个按钮。然后将不常使用的命令放到SecondaryCommands中。

    MainPage.xaml页面, 添加Page.BottomAppBar, 在CommandBar中新添加四个AppBarButton。在CommandBar.SecondaryCommands中添加一个Menu Item

    打开Card程序, 在MainPage.xaml页面, 在</Page>之前,新添加Page.BottomAppBar控件。 在Page.BottomAppBar控件中, 新添加CommandBar控件, 修改后代码如下:

    <Page.BottomAppBar>
        <CommandBar>
        </CommandBar>
    </Page.BottomAppBar>
    
    </Page>
    

    在CommandBar中加入第一个AppBarButton Control, 命名为abtnGetWishes, 设置其Icon属性,Label属性。

    <AppBarButton x:Name="abtnGetWishes" Icon="Play" Label="Wishes" />
    

    同样加入其它三个AppBarButton Control, 并设置相应属性。

    <AppBarButton x:Name="abtnGetWishes" Icon="Play" Label="Wishes" />
    <AppBarButton x:Name="abtnSendFriend" Icon="Send" Label="Wishes" />
    <AppBarButton x:Name="abtnOpenFile" Icon="Pictures" Label="Wishes" />
    <AppBarButton x:Name="abtnOpenCamera" Icon="Camera" Label="Wishes" />
    

    加入二级菜单项目。

    <CommandBar.SecondaryCommands>
        <AppBarButton x:Name="abtnLike" Icon="Like" Label="Like" />
    </CommandBar.SecondaryCommands>
    

    在第二和第三个AppBarButton之间加入AppBarSeparator,将命令分组。

    <AppBarSeparator />
    

    然后,定义abtnGetWishes的单击事件为GetMessage_Click, 定义abtnSendFriend的单击事件为SendMail_Click

    修改后代码如下:

    <Page.BottomAppBar>
        <CommandBar>
            <AppBarButton x:Name="abtnGetWishes" Icon="Play" Label="Wishes" Click="GetMessage_Click"/>
            <AppBarButton x:Name="abtnSendFriend" Icon="Send" Label="Send" Click="SendMail_Click"/>
            <AppBarSeparator />
            <AppBarButton x:Name="abtnOpenFile" Icon="Pictures" Label="Open" />
            <AppBarButton x:Name="abtnOpenCamera" Icon="Camera" Label="Camera" />
            <CommandBar.SecondaryCommands>
                <AppBarButton x:Name="abtnLike" Icon="Like" Label="Like" />
            </CommandBar.SecondaryCommands>
        </CommandBar>
    </Page.BottomAppBar>
    

    运行程序, 查看新添加CommandBar效果。

    Commandbar

  • 相关阅读:
    win10系统ping另一台电脑上虚拟机的IP
    -bash: locate: command not found
    oracle 数据库 主键索引重建
    SSM整合记录
    IE11安装需要获取更新-安装失败
    Unicode与中文的转换-javascript
    Unicode与中文的转换-java
    正则表达式--学习
    一段过滤HTML标签的代码
    出现$(#form).validate is not a function的问题 (就是validate验证不了)
  • 原文地址:https://www.cnblogs.com/qixue/p/4992251.html
Copyright © 2011-2022 走看看