[Net_Ghost] WPF实例教程(6)
2008-10-15 13:39
281 查看
代码所在位置:WPFSamples/Intro/QuickStart5
这个例子没有.cs文件,只有三个XAML文件,实现了在两个页面之间的跳转
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>
程序运行直接显示Page1
Page1.xaml
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel Background="LightBlue">
<TextBlock Margin="10,10,10,10">Start Page</TextBlock>
<TextBlock HorizontalAlignment="Left"
Margin="10,10,10,10">
<Hyperlink NavigateUri="Page2.xaml">Go To Page 2</Hyperlink>
</TextBlock>
</StackPanel>
</Page>
Page1,如下图所示
下面这行代码,定义了一个超链接,点击就可以连接到Page2
<Hyperlink NavigateUri="Page2.xaml">Go To Page 2</Hyperlink>
Page2.xaml
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel Background="LightGreen">
<TextBlock DockPanel.Dock="Top"
Margin="10,10,10,10">Page 2</TextBlock>
<TextBlock HorizontalAlignment="Left"
Margin="10,10,10,10">
<Hyperlink NavigateUri="Page1.xaml">Go To The Start Page</Hyperlink>
</TextBlock>
</StackPanel>
</Page>
链接到Page2的图片如下图所示:
这个例子没有.cs文件,只有三个XAML文件,实现了在两个页面之间的跳转
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>
程序运行直接显示Page1
Page1.xaml
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel Background="LightBlue">
<TextBlock Margin="10,10,10,10">Start Page</TextBlock>
<TextBlock HorizontalAlignment="Left"
Margin="10,10,10,10">
<Hyperlink NavigateUri="Page2.xaml">Go To Page 2</Hyperlink>
</TextBlock>
</StackPanel>
</Page>
Page1,如下图所示
下面这行代码,定义了一个超链接,点击就可以连接到Page2
<Hyperlink NavigateUri="Page2.xaml">Go To Page 2</Hyperlink>
Page2.xaml
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel Background="LightGreen">
<TextBlock DockPanel.Dock="Top"
Margin="10,10,10,10">Page 2</TextBlock>
<TextBlock HorizontalAlignment="Left"
Margin="10,10,10,10">
<Hyperlink NavigateUri="Page1.xaml">Go To The Start Page</Hyperlink>
</TextBlock>
</StackPanel>
</Page>
链接到Page2的图片如下图所示:
相关文章推荐
- [Net_Ghost] WPF实例教程(1)
- [Net_Ghost] WPF实例教程(2)
- [Net_Ghost] WPF实例教程(3)
- [Net_Ghost] WPF实例教程(4)
- [Net_Ghost] WPF实例教程(5)
- 轻松Ajax.net实例教程10_ModalPopupExtender(按AjaxControlToolkit字母排序)
- Ajax开发实例教程.NET页面屏聊系统
- 在asp.net中实际应用工作流(WWF)的2个实例教程
- ASP.NET使用Memcached高缓存实例(初级教程)
- vb.net 教程 5-12 绘图实例之统计图 3 饼图
- WPF 自定义雷达图开发实例教程
- 【ASP.NET Web API教程】3.3 通过WPF应用程序调用Web API(C#)
- Asp.Net MVC WPF案例教程集合
- 在WinForm和WPF中使用GMap.Net地图插件简单教程
- Discuz!NT与asp.net整合集成实例教程
- ADO.NET 数据库实例教程
- asp.net开发实战教程 asp.net开发框架入门实例教程
- ASP.NET Web API教程 创建Admin控制器实例分享
- 轻松Ajax.net实例教程5_CascadingDropDown(按AjaxControlToolkit字母排序)
- 【ASP.NET Web API教程】3.3 通过WPF应用程序调用Web API(C#)