UWP入门(一) -- 先写几个简单控件简单熟悉下(别看这个)
原文: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入门(一) -- 先写几个简单控件简单熟悉下(别看这个)的更多相关文章
- ASP.NET AJAX入门系列(6):UpdateProgress控件简单介绍
在ASP.NET AJAX Beta2中,UpdateProgress控件已经从“增值”CTP中移到了ASP.NET AJAX核心中.以下两篇关于UpdateProgress的文章基本翻译自ASP.N ...
- ASP.NET AJAX入门系列(10):Timer控件简单使用
本文主要通过一个简单示例,让Web页面在一定的时间间隔内局部刷新,来学习一下ASP.NET AJAX中的服务端Timer控件的简单使用. 主要内容 Timer控件的简单使用 1.添加新页面并切换到设计 ...
- 2013 duilib入门简明教程 -- 简单控件介绍 (12)
前面的教程应该让大家对duilib的整体有所映像了,下面就来介绍下duilib具体控件的使用. 由于官方没有提供默认的控件样式,所以我就尽量使用win7或者XP自带的按钮样式了,虽然界 ...
- duilib教程之duilib入门简明教程12.简单控件介绍
前面的教程应该让大家对duilib的整体有所映像了,下面就来介绍下duilib具体控件的使用. 由于官方没有提供默认的控件样式,所以我就尽量使用win7或者XP自带的按钮样式了,虽然界面比较土鳖 ...
- UWP学习记录5-设计和UI之控件和模式2
UWP学习记录5-设计和UI之控件和模式2 1.应用栏和命令栏 CommandBar 控件是一款通用.灵活.轻型的控件,可显示复杂内容(如图像或文本块)以及简单的命令(如 AppBarButton.A ...
- UWP学习记录4-设计和UI之控件和模式1
UWP学习记录4-设计和UI之控件和模式1 1.控件和事件简介 在 UWP 应用开发中,控件是一种显示内容或支持交互的 UI 元素. 控件是用户界面的构建基块. 我们提供了超过 45 种控件供你使用, ...
- WebForm简单控件,复合控件
简单控件: 1.Label 会被编译成span标签 属性: Text:文本内容 CssClass:CSS样式 Enlabled:是否可用 Visible:是否可见 __________________ ...
- Webform(简单控件、复合控件)
一.简单控件: 1.label控件 <asp:Label ID="Label1" runat="server" Text="账 号:" ...
- .net分页控件简单实现
.net分页控件简单实现 好久好久没写博客了.....最近写了一个.net的分页控件,放到园子里...你觉得好,就点个赞,不好呢,就告诉我为啥吧.... 是使用Request.QueryString的 ...
随机推荐
- BigDecimal 舍入模式(Rounding mode)介绍
BigDecimal 舍入模式(Rounding mode)介绍 什么样的经历,才能领悟成为架构师? >>> 1 RoundingMode介绍 package java.math ...
- Xcode7 不能使用http网络请求问题解决
最近使用Xcode 7.0 写代码,发送网路请求提示: App Transport Security has blocked a cleartext HTTP (http://) resource ...
- 【33.33%】【codeforces 608C】Chain Reaction
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- QT5.8.0+MSVC2015安装以及环境配置(不需要安装VS2015)
原文:QT5.8.0+MSVC2015安装以及环境配置(不需要安装VS2015) 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/snow_rain_ ...
- Java InputStream、String、File相互转化 --- good
String --> InputStreamByteArrayInputStream stream = new ByteArrayInputStream(str.getBytes()); Inp ...
- python 反转列表
翻转一个链表 您在真实的面试中是否遇到过这个题? Yes 样例 给出一个链表1->2->3->null,这个翻转后的链表为3->2->1->null 步骤是这样的: ...
- js延迟加载
setTimeout('yourFunction()',5000); 5秒后执行yourFunction(),只执行一次 setInterval('yourFunction()',5000); 每隔5 ...
- poj 3390 Print Words in Lines 动态规划
意甲冠军: 给n每行长度和字符可放置最大数量字m,每一行产生值至(m-x)^2,x是一个字符上线人数(包含空话之间格).为了让所有的完成,产生的话值最小和. 分析: 动态规划非常重要的就是状态的定义, ...
- wpf无边框窗体移动和大小调整
原文:wpf无边框窗体移动和大小调整 using System; using System.Windows; using System.Windows.Interop; namespace Wpf ...
- python代码风格检查工具──pylint
pylint是一个python代码检查工具,可以帮助python程序员方便地检查程序代码的语法和风格,通过这个工具,可以使你的python代码尽量保持完美,哈哈.具体可以检查什么东西呢?比如你写了 f ...