WPF实例学习(A-01)
2007-10-19 17:04
357 查看
代码所在位置:WPFSamples"Intro"QuickStart1
这个例子,可以认为是WPF应用的Hello Worldchen 程序
目录下面一共有两个XAML文件MyApp.xaml和Page1.xaml
XAML是XML的一个子集,如果熟悉XML或者HTML的人会很容易看懂,不熟悉的也能很容易看懂J
MyApp.xaml
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Page1.xaml">
</Application>
MyApp.xaml 文件中
使用[Application]标签定义了一个应用
通过 StartupUri="Page1.xaml"
定义了一个应用(Application)的启动页面为Page1.xaml
下面再看 Page1.xaml
Page1.xaml
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<StackPanel
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBlock>
Hello, World!
</TextBlock>
</StackPanel>
</Page>
Page1.xaml 文件中使用 [Page]标签定义页面。
然后定义了页面的一个布局(LayOut)为 [StackPanel],当然,XAML中还有许多其他类型的布局,在以后会逐一介绍的,大家先不用着急。
接着,在[StackPanel]的内部定义了一个 [TextBlock]这样在页面上就会显示一个TextBlock,其内容为Hello, World!
程序编译之后的运行截图如下:
500){this.resized=true;this.style.width=500;}" resized="true">
这个例子,可以认为是WPF应用的Hello Worldchen 程序
目录下面一共有两个XAML文件MyApp.xaml和Page1.xaml
XAML是XML的一个子集,如果熟悉XML或者HTML的人会很容易看懂,不熟悉的也能很容易看懂J
MyApp.xaml
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Page1.xaml">
</Application>
MyApp.xaml 文件中
使用[Application]标签定义了一个应用
通过 StartupUri="Page1.xaml"
定义了一个应用(Application)的启动页面为Page1.xaml
下面再看 Page1.xaml
Page1.xaml
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<StackPanel
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBlock>
Hello, World!
</TextBlock>
</StackPanel>
</Page>
Page1.xaml 文件中使用 [Page]标签定义页面。
然后定义了页面的一个布局(LayOut)为 [StackPanel],当然,XAML中还有许多其他类型的布局,在以后会逐一介绍的,大家先不用着急。
接着,在[StackPanel]的内部定义了一个 [TextBlock]这样在页面上就会显示一个TextBlock,其内容为Hello, World!
程序编译之后的运行截图如下:
500){this.resized=true;this.style.width=500;}" resized="true">
相关文章推荐
- WPF实例学习(A-01)
- [转载] WPF实例学习 (A-01)
- WPF学习笔记 - 如何用WPF创建单实例应用程序
- WPF 学习记录——源码实例
- WPF学习01——新的图形引擎DirectX
- WPF学习笔记 - 如何用WPF创建单实例应用程序
- 【MyBatis学习01】一个简单入门实例
- WPF学习笔记(01) - 准备起航
- WPF学习01——体系结构
- 【Spring】Spring学习笔记-01-入门级实例
- WPF实例学习(00)
- Ext学习笔记01 - NameSpace,类实例属性,类实例方法,类静态方法
- [Python][Scikit-learn][学习笔记01]线性回归之波士顿房价实例分析
- 【Spring】Spring学习笔记-01-入门级实例
- WPF学习01——高级API
- WPF实例学习(A-04)
- 【Cocos2d-x3.0学习笔记 09】游戏实例跑跑跑01
- 01.Cadence学习(教材《Cadence 15.7 SPB工程实例入门》)
- WPF实例学习(A-05)
- JavaWeb学习笔记-spring-01-概述(实例)