Windows 8.1 新增控件之 CommandBar
上一篇为大家介绍了AppBar 的相关内容,本篇继续介绍CommandBar 的使用方法。与AppBar 相比而言,CommandBar 在开发使用方面较为单一,在按键布局上分为主控区(Primary Commands)与辅控区(Secondary Commands),默认情况下,主控区显示在菜单右侧,辅控区在左侧。
如果应用菜单栏中只包含AppBarButton、AppBarToggleButton、AppBarSeparator 这几个控件,且没有特殊布局格式要求,及可以使用CommandBar 控件。当应用尺寸变化时,CommandBar 也会随之调整尺寸。
<Page.BottomAppBar>
<CommandBar>
<AppBarButton x:Uid="Camera" Icon="Camera" Label="Camera"/>
<AppBarToggleButton x:Uid="Suffle" Icon="Shuffle" Label="Shuffle"/>
<AppBarToggleButton x:Uid="Account" Icon="Account" Label="Account"/>
<AppBarButton x:Uid="Like" Icon="Like" Label="Like"/>
<AppBarButton x:Uid="Dislike" Icon="Dislike" Label="Dislike"/> <AppBarSeparator/> <AppBarButton x:Uid="Add" Icon="Add" Label="Add"/>
<AppBarToggleButton x:Uid="Remove" Icon="Remove" Label="Remove"/>
<AppBarButton x:Uid="Delete" Icon="Delete" Label="Delete"/>
</CommandBar>
</Page.BottomAppBar>

如上面代码,默认所有控件都是分配在主控区及菜单栏右侧,将Add、Remove、Delete 按键放入辅控区是什么样子呢,如下:
<Page.BottomAppBar>
<CommandBar>
<AppBarButton x:Uid="Camera" Icon="Camera" Label="Camera"/>
<AppBarToggleButton x:Uid="Suffle" Icon="Shuffle" Label="Shuffle"/>
<AppBarToggleButton x:Uid="Account" Icon="Account" Label="Account"/>
<AppBarButton x:Uid="Like" Icon="Like" Label="Like"/>
<AppBarButton x:Uid="Dislike" Icon="Dislike" Label="Dislike"/> <AppBarSeparator/> <CommandBar.SecondaryCommands>
<AppBarButton x:Uid="Add" Icon="Add" Label="Add"/>
<AppBarToggleButton x:Uid="Remove" Icon="Remove" Label="Remove"/>
<AppBarButton x:Uid="Delete" Icon="Delete" Label="Delete"/>
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>

如上图所示,写入SecondaryCommands 的按键被分配到了菜单栏左侧。关于CommandBar 介绍就到这里,大家可以动手操练一下。
Windows 8.1 新增控件之 CommandBar的更多相关文章
- 重新想象 Windows 8.1 Store Apps (72) - 新增控件: AppBar, CommandBar
[源码下载] 重新想象 Windows 8.1 Store Apps (72) - 新增控件: AppBar, CommandBar 作者:webabcd 介绍重新想象 Windows 8.1 Sto ...
- Windows 8.1 新增控件之 AppBar
Windows 8.1 与Windows 8 相比已经有了很多改进,从ITPro 角度这篇文章<What's New in Windows 8.1>已经表述的很详细.对开发者来说,最明显的 ...
- Windows 8.1 新增控件之 DatePicker
大年初一来介绍一个简单易用的DatePicker 控件,这个控件是新增的?印象里很早就有了啊,Anyway来看看Windows 8.1 里的DataPicker 有什么功能吧. 先来看看这个代码,很简 ...
- Windows 8.1 新增控件之 Hyperlink
Hyperlink 控件应该不用过多介绍大家肯定十分清楚其作用,它的功能就像HTML中的<a href="">标签一样,只不过是在XAML中实现. 使用Hyperlin ...
- Windows 8.1 新增控件之 TimePicker
之前已经为大家介绍过DatePicker 控件的相关内容,有日期控件当然就得有时间控件,本篇将和各位一起了解TimePicker 的使用方法. 先来介绍一下ClockIdentifier 属性,默认情 ...
- Windows 8.1 新增控件之 MenuFlyout
开始这篇讲解前,我们先来温习一下Flyout 的内容,当触发应用中某个Button 时会有Flyout 出现提示用户该操作接下来将会发生什么.Flyout 简单来说就是一个轻量级信息提示需要用户确认或 ...
- Windows 8.1 新增控件之 Flyout
本篇为大家介绍Flyout 控件,Flyout 属于一种轻量级交互控件,可以支持信息提示或用户交互.与传统Dialog 控件不同的是Flyout 控件可通过直接点击对话框外部区域忽略. Flyout ...
- Windows 8.1 应用再出发 - 几种新增控件(1)
Windows 8.1 新增的一些控件,分别是:AppBar.CommandBar.DatePicker.TimePicker.Flyout.MenuFlyout.SettingsFlyout.Hub ...
- Windows 8.1中WinRT的变化(一)——新增控件
这次WinRT的变化还是不小的,就拿新增控件来说,就有如下几种: AppBar 控件 我以前写过一篇文章接受过如何在WinRT程序中快速创建Metro风格图标,现在MS已经把他们标准化了,就不用我们自 ...
随机推荐
- Swfit 字符与字符串
Swfit 字符与字符串 OC 定义字符 char charValue = 'a'; Swift 定义字符 var charValue:Character = "a" Unicod ...
- 用于主题检测的临时日志(9ef9ede0-46b6-438d-8fb4-ba6b911a34fa - 3bfe001a-32de-4114-a6b4-4005b770f6d7)
这是一个未删除的临时日志.请手动删除它.(258a3e7d-420b-4c9f-bba2-e0ee0f0f198b - 3bfe001a-32de-4114-a6b4-4005b770f6d7)
- Selenium Test 自动化测试 入门级学习笔记
1.下载安装Firefox-selenium插件 需要下载插件可以联系,这里暂不提供下载地址. 2.集成Eclipse 需要下载jar包可以联系,这里暂不提供下载地址. 集成Eclipse非常简单,加 ...
- Asp.Net MVC 自定义的MVC框架(非EF操作数据库)
一些废话:在北京辞职回家不知不觉中已经半年多了,这半年中有过很多的彷徨,困惑,还有些小小难受.半年时间算是我人生以来遇到过的最困苦的时候.理想的工作跟我擦肩而过,驾照也没有考过,年后这一改革...,毕 ...
- C#生成注册码
string t = DateTime.Now.Ticks.ToString(); t = DESKey.DESEncrypt(t, DESKey.DesKeyStr); string[] strid ...
- 如何在linux设置回收站
修改用户的环境变量 vi ~/.bashrc 注释第5行的别名 #alias rm='rm -i' 最后一行添加如下内容 mkdir -p ~/.trash alias rm=trash alias ...
- Oracle global database name与db link的纠缠关系
ORACLE数据库中Global Database Name与DB LINKS的关系还真是有点纠缠不清,在说清楚这个关系前,我们先来了解一下Global Database Name的概念 Global ...
- android中的万能适配器BaseAdapter的总结
有时候,列表不光会用来做显示用,我们同样可以在在上面添加按钮.添加按钮首先要写一个有按钮的xml文件,然后自然会想到用上面的方法定义一个适配器,然后将数据映射到布局文件上.但是事实并非这样,因为按钮是 ...
- my_ls
#include<stdio.h> #include<dirent.h> #include<string.h> #include<sys/types.h> ...
- proteus怎么仿真?
加入hex 文件 双击 单片机芯片 AT89C51 弹出对话框,选择好 用keil 编译好的 hex 文件,晶振 12 即可. 运行