Windows 8技巧:Xaml+C#开发第一个Metro Style应用程序的使用
时间:2022-04-30 13:31:08
本篇文章小编为大家介绍,Windows 8技巧:Xaml+C#开发第一个Metro Style应用程序的使用。需要的朋友参考下首先我们需要安装Windows 8以及VS2012,下载地址:http://msdn.microsoft.com/zh-CN/windows/apps/br229516/
然后我们打开VS2012,选择Windows Metro Style,然后选择创建Blank App项目如下图:
其新建完成的项目结构如下:
我们拖动一个按钮和ListBox到界面中,设置按钮事件以及ListBox的DataTemplate,如下Xaml代码:
复制代码代码如下:
其Xaml.cs文件如下:
复制代码代码如下:
///
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
listbox1.ItemsSource = ItemModel.GetItem();
button1.Content = "Windows 8按钮";
}
///
///Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
private void button1_Click(object sender, RoutedEventArgs e)
{
this.button1.Content = this.button1.Content + "1";
}
}
ListBox绑定的数据源代码如下:
复制代码代码如下:
public class ItemModel
{
public string ItemName { get; set; }
public string ItemValue { get; set; }
public static List
运行效果图如下:
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Win10电脑怎么关闭电脑的广告弹窗?
![](https://img.aspxhome.com/file/2023/26/a220764_0s.png)
Word2003如何设置水平对齐方式
WPS演示制作下拉式列表导航让演讲者在放映中轻松定位
![](https://img.aspxhome.com/file/2023/2/a169342_0s.png)
Win10如何关闭锁屏广告?Win10系统去除锁屏界面广告的方法
![](https://img.aspxhome.com/file/2023/26/a221681_0s.jpg)
如何将存储卡转换为DVD
![](https://img.aspxhome.com/file/2023/7/a210867_0s.jpeg)
excel 利用快捷键 快速找到两列异同
![](https://img.aspxhome.com/file/2023/7/a154557_0s.jpg)
excel批量合并单元居中,还在手工点合并后居中吗,有两种更快的方法
![](https://img.aspxhome.com/file/2023/4/a140184_0s.jpg)
macqq音乐如何下载无损品质歌曲
![](https://img.aspxhome.com/file/2023/0/a214320_0s.jpeg)
Win10系统任务栏图标变成空白方块怎么办?
![](https://img.aspxhome.com/file/2023/9/50939_0s.png)
excel 公式 #DIV/0! 错误
![](https://img.aspxhome.com/file/2023/9/a161969_0s.png)
在word2003中如何输入下划线
excel表格内怎样设置文字对齐
【Mac实用技巧】无需第三方快速压缩Mac文件
![](https://img.aspxhome.com/file/2023/2/a206932_0s.jpeg)
Excel创建修饰统计表格必备的9个技巧
![](https://img.aspxhome.com/file/2023/1/a141651_0s.jpg)
MATCH函数使VLOOKUP函数更灵活高效
![](https://img.aspxhome.com/file/2023/9/a142549_0s.png)
如何利用Excel跟踪调研答案全对的员工 Excel单元格自带“真假”的判断
![](https://img.aspxhome.com/file/2023/9/a155349_0s.jpg)
Word使用通配符批量删除字母数字汉字教程
![](https://img.aspxhome.com/file/2023/1/31401_0s.png)
MAC如何关掉QuickTime升级提示窗口及制作网页PDF档案
![](https://img.aspxhome.com/file/2023/2/a216512_0s.jpg)
如何显示wps文字中的菜单栏
如何将txt中的数据导入wps表格中?
![](https://img.aspxhome.com/file/2023/8/a163868_0s.jpg)