win10 UWP Controls by function

最后更新于:2022-04-01 20:23:46

Windows的XAML UI框架提供了很多控件,支持用户界面开发库。其中一些有可视化,一些布局。  一些控件例子:[https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/XamlUIBasics](https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/XamlUIBasics) 我现在做的一个中文版的,很多都是照着微软写,除了注释 我们先学微软做一个简单的frame,新建Page,  里面放title和跳转页 ~~~ public class page { public page() { } /// /// 跳转页 /// public Type navigate { set { _navigate = value; } get { return _navigate; } } /// /// 页面名 /// public string title { set { _title = value; } get { return _title; } } private Type _navigate; private string _title; } ~~~ 我们需要把所有页放到一个类,本来这个类可以不弄,直接放Page  使用索引  最后我还是想给宝资通打广告  弄了一个类,本来应该叫page管理器,我叫baozitong  输入title返回type ~~~ public static Type page(string title) { foreach (var temp in _page) { if (temp.title == title) { return temp.navigate; } } return null; } public static List _page { set; get; }=new List() { new page() { title = "appbar", navigate = typeof(appbar) } }; ~~~ 每次添加page可以在baozitong._page new page 界面splitview ~~~ ~~~ ~~~ private void nagivate(object sender, SelectionChangedEventArgs e) { //跳转navigate frame.Navigate(((sender as ListView).SelectedItem as page).navigate); } ~~~ ## Appbars and commands ### App bar 用于显示应用程序特定命令的工具栏。 ### App bar button 使用app bar风格按钮  一个简单的按钮 ~~~ ~~~ ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_570763769cc39.jpg)  我们可以加上内容 ~~~ ~~~ ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_57076376ae0f0.jpg)  我们可以在按钮加浮出 ~~~ ~~~ ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_57076376bf84a.jpg) ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_57076376d2dd9.jpg) ### App bar separator 命令栏中的命令组。  如果我们有很多按钮,我们可以使用 ~~~ ~~~ ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_57076376e656a.jpg) ### App bar toggle button 开关命名命令栏 ### Command bar 一种专门处理命令按钮栏按钮 我们把刚才的按钮放在`` ~~~ ~~~ ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_570763770263a.jpg) 我们也看到最后的按钮,如果有一些用不到,但是有用 ~~~ ~~~ ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_5707637714cf0.jpg) ## Buttons ### Button 响应用户输入和点击事件。 ~~~ ~~~ ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_5707637725931.jpg) 按钮点击可以使用`X:Bind` ### Hyperlink 超链接 ~~~ 博客发在csdn ,没有授权红黑转载,没有授权推酷转载 ~~~ ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_5707637749283.jpg) ### Repeat button 用户点击不停响应。 ## Collection/data controls ### Flip view 幻灯片播放 ~~~ ~~~ ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_5707637761d18.jpg) [http://www.cnblogs.com/Damai-Pang/p/5201206.html](http://www.cnblogs.com/Damai-Pang/p/5201206.html) ### Grid view 行列布局,可以水平滚动控件。 ### Items control 提供UI指定数据模板 ### List view 在一个列表上的项目的集合,可以垂直滚动控件  我们做一个viewmodel ~~~ public class viewmodel : notify_property { public viewmodel() { } } ~~~ 我们依列表 ~~~ public ObservableCollection lindexi { set; get; } = new ObservableCollection() { "林德熙", "csdn" }; ~~~ ~~~ ~~~ ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_57076377c1426.jpg) ## Date and time controls ### Calendar date picker 日历日期选择器  ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_57076377d303b.png)  ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_57076377e7c3c.jpg) ### Calendar view 日程表,让用户选择日期  ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_5707637802a3f.jpg) ### Time picker 用户选择一个时间  ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_57076378123aa.jpg) ## Flyouts ### Flyout 显示一条消息 ~~~ ~~~ ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-08_570763782352e.jpg) ### Menu flyout 暂时显示命令或列出选项给用户选择 ~~~ ~~~ ### Popup menu 弹出自己写的菜单 ### Tooltip 提示 ~~~
';