更新:2007 年 11 月
命名空间:
System.Windows.Controls 程序集:
PresentationFramework(在 PresentationFramework.dll 中)
用于 XAML 的 XMLNS:http://schemas.microsoft.com/winfx/xaml/presentation
<ContentPropertyAttribute("Content")> _
Public Class Page _
Inherits FrameworkElement _
Implements IAddChild
[ContentPropertyAttribute("Content")]
public class Page : FrameworkElement, IAddChild
[ContentPropertyAttribute(L"Content")]
public ref class Page : public FrameworkElement,
IAddChild
/** @attribute ContentPropertyAttribute("Content") */
public class Page extends FrameworkElement implements IAddChild
public class Page extends FrameworkElement implements IAddChild
Page 封装一页可导航的内容,并具有以下关键成员:
可以使用标记、标记和代码隐藏或者代码来定义页。页通常是为导航而打包内容的首选方式,原因如下:
页可以通过 Window、NavigationWindow、Frame、UserControl 或浏览器来承载。要进行承载,页可以:
一个应用程序通常具有两个或更多页,可以使用以下机制在这些页之间导航:
有关使用页函数 (PageFunction<(Of <(T>)>)) 的结构化导航,请参见结构化导航概述和导航拓扑概述。
下面的示例演示如何只使用标记来定义一个标准页:
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Markup Page">
<!-- Page Content Goes Here -->
</Page>
下面的示例演示如何只使用代码来定义一个标准页:
using System.Windows.Controls;
public class CodePage : Page
{
public CodePage() {}
}
下面的示例演示如何使用标记与代码隐藏的组合来定义一个标准页。
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="MarkupAndCodeBehindPage"
Title="Markup And Code-Behind Page">
<!-- Page Content Goes Here -->
</Page>
using System.Windows.Controls;
public partial class MarkupAndCodeBehindPage : Page
{
public MarkupAndCodeBehindPage()
{
InitializeComponent();
}
}
System..::.Object
System.Windows.Threading..::.DispatcherObject
System.Windows..::.DependencyObject
System.Windows.Media..::.Visual
System.Windows..::.UIElement
System.Windows..::.FrameworkElement
System.Windows.Controls..::.Page
System.Windows.Navigation..::.PageFunctionBase
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
.NET Framework
受以下版本支持:3.5、3.0
参考
其他资源