Page Class

Definition

Encapsulates a page of content that can be navigated to and hosted by Windows Internet Explorer, NavigationWindow, and Frame.

[System.Windows.Markup.ContentProperty("Content")]
public class Page : System.Windows.FrameworkElement, System.Windows.Markup.IAddChild
Inheritance
Derived
Attributes
Implements

Inherited Members

System.Object

System.Windows.DependencyObject

System.Windows.FrameworkElement

System.Windows.Media.Visual

System.Windows.Threading.DispatcherObject

System.Windows.UIElement

Examples

The following example shows how a standard page is defined using only markup:

<Page 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    Title="Markup Page">
  <!-- Page Content Goes Here -->
</Page>

The following example shows how a standard page is defined using only code:

using System.Windows.Controls;

public class CodePage : Page
{
    public CodePage() {}
}

Imports System.Windows.Controls

Public Class CodePage
	Inherits Page
	Public Sub New()
	End Sub
End Class

The following example shows how a standard page is defined using a combination of markup and code-behind.

<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();
    }
}

Imports System.Windows.Controls

Partial Public Class MarkupAndCodeBehindPage
	Inherits Page
	Public Sub New()
		InitializeComponent()
	End Sub
End Class

Remarks

Page encapsulates a page of content that can be navigated, and has the following key members:

A page can be defined by using markup, markup and code-behind, or code. A page is the preferred way to package content for navigation, for the following reasons:

A page can be hosted from Window, NavigationWindow, Frame, or from a browser. To be hosted, a page can be:

An application typically has two or more pages, which can be navigated between using the following mechanisms:

For structured navigation using page functions (PageFunction<T>), see Structured Navigation Overview and Navigation Topologies Overview.

Dependency properties for this control might be set by the control’s default style. If a property is set by a default style, the property might change from its default value when the control appears in the application. The default style is determined by which desktop theme is used when the application is running. For more information, see Default WPF Themes.

Constructors

Page()

Initializes a new instance of the Page class.

Fields

Background​Property

Identifies the Background dependency property.

Content​Property

Identifies the Content dependency property.

Font​Family​Property

Identifies the FontFamily dependency property.

Font​Size​Property

Identifies the FontSize dependency property.

Foreground​Property

Identifies the Foreground dependency property.

Keep​Alive​Property

Identifies the KeepAlive dependency property.

Template​Property

Identifies the Template dependency property.

Title​Property

Identifies the Title dependency property.

Properties

Background

Gets or sets the background for a Page.

Content

Gets or sets the content of a Page.

Font​Family

Gets or sets the name of the specified font family.

Font​Size

Gets or sets the font size.

Foreground

Gets or sets the foreground for a Page.

Keep​Alive

Gets or sets a value that indicates whether the Page instance is retained in navigation history.

Logical​Children

Returns an enumerator for the logical child elements of a Page.

Navigation​Service

Gets the navigation service that the host of the page is using to manage navigation.

Shows​Navigation​UI

Gets or sets a value that indicates whether the navigation UI of a NavigationWindow on Microsoft Internet Explorer 6 is visible.

Template

Gets or sets the control template for a Page.

Title

Gets or sets the title of the Page.

Window​Height

Gets or sets the height of the host Window or NavigationWindow of a Page.

Window​Title

Gets or sets the title of the host Window or NavigationWindow of a Page.

Window​Width

Gets or sets the width of the host Window or NavigationWindow of a Page.

Methods

Arrange​Override(​Size)

Arranges the content (child elements) of the Page.

Measure​Override(​Size)

Measures the child elements of the Page.

On​Template​Changed(​Control​Template, ​Control​Template)

Called when the template for a Page changes.

On​Visual​Parent​Changed(​Dependency​Object)

Called when the parent of the Page is changed.

Should​Serialize​Shows​Navigation​UI()

Allows derived classes to determine the serialization behavior of the ShowsNavigationUI property.

Should​Serialize​Title()

Allows derived classes to determine the serialization behavior of the Title property.

Should​Serialize​Window​Height()

Allows derived classes to determine the serialization behavior of the WindowHeight property.

Should​Serialize​Window​Title()

Allows derived classes to determine the serialization behavior of the WindowTitle property.

Should​Serialize​Window​Width()

Allows derived classes to determine the serialization behavior of the WindowWidth property.

Explicit Interface Implementations

I​Add​Child.​Add​Child(​Object)

For a description of this member, see AddChild(Object).

I​Add​Child.​Add​Text(​String)

For a description of this member, see AddText(String).