原文:UWP入门(一) -- 先写几个简单控件简单熟悉下(别看这个)

1. MainPage.xmal

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Pivot x:Name="rootPivot" Title="Pivot Title">
<PivotItem Header="Pivot Item 1">
<!--Pivot content goes here-->
<TextBlock Text="Content of pivot item 1."/>
</PivotItem>
<PivotItem Header="Pivot Item 2">
<!--Pivot content goes here-->
<TextBlock Text="Content of pivot item 2."/>
</PivotItem>
<PivotItem Header="Pivot Item 3">
<!--Pivot content goes here-->
<TextBlock Text="Content of pivot item 3."/>
</PivotItem>
</Pivot>
<StackPanel VerticalAlignment="Bottom" HorizontalAlignment="Center">
<ListView x:Name="listView1">
<x:String>Item 1</x:String>
<x:String>Item 2</x:String>
<x:String>Item 3</x:String>
<x:String>Item 4</x:String>
<x:String>Item 5</x:String>
</ListView>
<Button Content="Submit" Click="SubmitButton_Click"/>
<Button x:Name="btnMyClick" Click="Button_Click_1" Content="MessageDialog"/>
<Button x:Name="btnMyClick2" Click="Button_Click_2" Content="ContentDialog"/>
<TextBlock x:Name="response" FontSize="36"/>
<TextBlock x:Name="ticker" FontSize="36"/>
</StackPanel>
<Button x:Name="button" Content="Media" HorizontalAlignment="Left" Margin="149,177,0,0" VerticalAlignment="Top" Height="45" Width="69" Click="button_Click"/>
</Grid>
</Page>

1.1 导航栏 (就是 标签栏)

     <Pivot x:Name="rootPivot" Title="Pivot Title">
<PivotItem Header="Pivot Item 1">
<!--Pivot content goes here-->
<TextBlock Text="Content of pivot item 1."/>
</PivotItem>
<PivotItem Header="Pivot Item 2">
<!--Pivot content goes here-->
<TextBlock Text="Content of pivot item 2."/>
</PivotItem>
<PivotItem Header="Pivot Item 3">
<!--Pivot content goes here-->
<TextBlock Text="Content of pivot item 3."/>
</PivotItem>
</Pivot>

1.2 listview

            <ListView x:Name="listView1">
<x:String>Item 1</x:String>
<x:String>Item 2</x:String>
<x:String>Item 3</x:String>
<x:String>Item 4</x:String>
<x:String>Item 5</x:String>
</ListView>

1.3 Button

     <StackPanel VerticalAlignment="Bottom" HorizontalAlignment="Center">
<Button Content="Submit" Click="SubmitButton_Click"/>
<Button x:Name="btnMyClick" Click="Button_Click_1" Content="MessageDialog"/>
<Button x:Name="btnMyClick2" Click="Button_Click_2" Content="ContentDialog"/>
</StackPanel>

按 F12 生成点击事件代码,(async 异步)

  private async void Button_Click_1(object sender, RoutedEventArgs e)
{
await new Windows.UI.Popups.MessageDialog("Hello World").ShowAsync();
} private async void Button_Click_2(object sender, RoutedEventArgs e)
{
var dialog = new ContentDialog()
{
Title = "提示",
Content = "你确认要退出该页面吗?",
PrimaryButtonText = "确定",
SecondaryButtonText = "取消",
FullSizeDesired = false,
}; await dialog.ShowAsync();
} private async void button_Click(object sender, RoutedEventArgs e)
{
MediaElement mediaElement = new MediaElement();
var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer();
Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("I Love U");
mediaElement.SetSource(stream, stream.ContentType);
mediaElement.Play();
} private async void SubmitButton_Click(object sender, RoutedEventArgs e)
{
// Call app specific code to submit form. For example:
// form.Submit();
Windows.UI.Popups.MessageDialog messageDialog =
new Windows.UI.Popups.MessageDialog("Thank you for your submission.");
await messageDialog.ShowAsync(); }

UWP入门(一) -- 先写几个简单控件简单熟悉下(别看这个)的更多相关文章

  1. ASP.NET AJAX入门系列(6):UpdateProgress控件简单介绍

    在ASP.NET AJAX Beta2中,UpdateProgress控件已经从“增值”CTP中移到了ASP.NET AJAX核心中.以下两篇关于UpdateProgress的文章基本翻译自ASP.N ...

  2. ASP.NET AJAX入门系列(10):Timer控件简单使用

    本文主要通过一个简单示例,让Web页面在一定的时间间隔内局部刷新,来学习一下ASP.NET AJAX中的服务端Timer控件的简单使用. 主要内容 Timer控件的简单使用 1.添加新页面并切换到设计 ...

  3. 2013 duilib入门简明教程 -- 简单控件介绍 (12)

        前面的教程应该让大家对duilib的整体有所映像了,下面就来介绍下duilib具体控件的使用.     由于官方没有提供默认的控件样式,所以我就尽量使用win7或者XP自带的按钮样式了,虽然界 ...

  4. duilib教程之duilib入门简明教程12.简单控件介绍

    前面的教程应该让大家对duilib的整体有所映像了,下面就来介绍下duilib具体控件的使用.    由于官方没有提供默认的控件样式,所以我就尽量使用win7或者XP自带的按钮样式了,虽然界面比较土鳖 ...

  5. UWP学习记录5-设计和UI之控件和模式2

    UWP学习记录5-设计和UI之控件和模式2 1.应用栏和命令栏 CommandBar 控件是一款通用.灵活.轻型的控件,可显示复杂内容(如图像或文本块)以及简单的命令(如 AppBarButton.A ...

  6. UWP学习记录4-设计和UI之控件和模式1

    UWP学习记录4-设计和UI之控件和模式1 1.控件和事件简介 在 UWP 应用开发中,控件是一种显示内容或支持交互的 UI 元素. 控件是用户界面的构建基块. 我们提供了超过 45 种控件供你使用, ...

  7. WebForm简单控件,复合控件

    简单控件: 1.Label 会被编译成span标签 属性: Text:文本内容 CssClass:CSS样式 Enlabled:是否可用 Visible:是否可见 __________________ ...

  8. Webform(简单控件、复合控件)

    一.简单控件: 1.label控件 <asp:Label ID="Label1" runat="server" Text="账 号:" ...

  9. .net分页控件简单实现

    .net分页控件简单实现 好久好久没写博客了.....最近写了一个.net的分页控件,放到园子里...你觉得好,就点个赞,不好呢,就告诉我为啥吧.... 是使用Request.QueryString的 ...

随机推荐

  1. JVM源码分析之System.currentTimeMillis及nanoTime原理详解

    JDK7和JDK8下的System.nanoTime()输出完全不一样,而且差距还非常大,是不是两个版本里的实现不一样,之前我也没注意过这个细节,觉得非常奇怪,于是自己也在本地mac机器上马上测试了一 ...

  2. bootstrap, boosting, bagging

    介绍boosting算法的资源: 视频讲义.介绍boosting算法,主要介绍AdaBoosing http://videolectures.net/mlss05us_schapire_b/ 在这个站 ...

  3. cocos2d-x 3.0学习游戏笔记的例子《卡塔防》第五步---开始建立游戏界面

    /* 说明: **1.本次游戏实例是<cocos2d-x游戏开发之旅>上的最后一个游戏,这里用3.0重写并做下笔记 **2.我也问过木头本人啦,他说:随便写.第一别全然照搬代码.第二能够说 ...

  4. 关于J2SE/Jsp/Sping/Hibernate/Struts2的视频下载

    我是一名程序猿,从大学就開始学计算机.后来參加了编程工作.如今我认为若要做一名程序猿须要具备三个条件,这三个条件也是衡量一个人能否够成为程序猿的条件. 1.对计算机拥有浓厚的兴趣. 2.良好的逻辑思维 ...

  5. Optimizing concurrent accesses in a directory-based coherency protocol

    In one embodiment, the present invention includes a directory to aid in maintaining control of a cac ...

  6. VS解决方案文件格式说明

    作者:朱金灿 来源:http://blog.csdn.net/clever101 VS解决方案文件本质是一个文件文件,这个用记事本或者Node++之类的文本编辑软件打开一个VS解决方案文件就知道了.了 ...

  7. Android开发中如何加载API源码帮助开发

    在eclipse中添加android源码既可以帮助我们的开发,又能使我们边开发边学习. android环境的搭建:http://blog.csdn.net/dawanganban/article/de ...

  8. 在Android手机上学习socket程序

    我们都知道Android手机是基于Linux系统的,在没有Linux环境,但是想学习socket编程的同学可以在Android手机中试试,利用ndk编译可执行文件在Android手机中运行.不同于动态 ...

  9. xcode代码统计行

    输入端子 cd 通路 进入项目根文件夹 输入以下的命令.显示总行数(不包括空行.包括凝视和应用第三方类) find . -name "*.m" -or -name "*. ...

  10. 2 WCF里面配置的含义

    1 首先介绍所谓的a,b,c. a就是address 地址: b binding 绑定的协议 譬如http  tcp udp 利用这些协议方式请求address: c contract  代表请求的规 ...