Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
[LocalizabilityAttribute(LocalizationCategory.Ignore)] [ContentPropertyAttribute] [TemplatePartAttribute(Name="PART_FrameCP", Type=typeof(ContentPresenter))] public class Frame : ContentControl, IAddChild, IUriContext
/** @attribute LocalizabilityAttribute(LocalizationCategory.Ignore) */ /** @attribute ContentPropertyAttribute() */ /** @attribute TemplatePartAttribute(Name="PART_FrameCP", Type=System.Windows.Controls.ContentPresenter) */ public class Frame extends ContentControl implements IAddChild, IUriContext
LocalizabilityAttribute(LocalizationCategory.Ignore) ContentPropertyAttribute TemplatePartAttribute(Name="PART_FrameCP", Type=System.Windows.Controls.ContentPresenter) public class Frame extends ContentControl implements IAddChild, IUriContext
Frame is a content control that provides the ability to navigate to and display content. Frame can be hosted within other content, as with other controls and elements.
Content can be any type of .NET Framework 3.0 object and HTML files. In general, however, pages are the preferred as the way to package content for navigation (see Page).
Content can be navigated to by setting the Source property with the URI for the desired content. Additionally, content can be navigated to by using one of the following overloads of the Navigate method:
When content is navigated to by URI, Frame will return an object that contains the content. Alternatively, content can be navigated to by using one of the Navigate method overloads that accepts an object:
The lifetime of a navigation can be tracked through the following events:
Not all events are raised each time that a navigation occurs; the set of events that are raised is determined by the type of navigation that occurs (content or content fragment) and how the navigation completes (canceled, stopped, or failed).
The following figure illustrates the sequence in which these events will fire:
During or after a navigation, Frame provides information about the content that is being navigated to, including the URI of the content being navigated to (Source), the URI of the current content (CurrentSource), and an object that contains the content that was navigated to (Content).
When content is navigated to, Frame records the navigation as an entry in navigation history. An entry is added to back navigation history when either a new navigation occurs, by calling the Navigate method, or by navigating to an entry in forward navigation history, by calling GoForward. An entry is added to forward navigation history by navigating to an entry in back navigation history, by calling GoBack. CanGoBack and CanGoForward report whether there are entries in back and forward navigation history, respectively.
The first time that one piece of content is navigated to from another piece of content, Frame automatically displays a navigation UI that allows users to navigate back and forwards through navigation history. You can configure when the navigation UI is shown by setting the NavigationUIVisibility property.
By default, Frame will use its own navigation history only if a parent navigator (NavigationWindow, Frame) with its own navigation history can't be found. This means that navigation history entries for the frame will be mingled with navigation history entries for the parent navigator. To specify that a Frame manages its own navigation history, set the JournalOwnership property to OwnsJournal. This type of Frame is known as an "island frame".
The most recent entry in back navigation history can be removed by calling RemoveBackEntry.
Frame does not store an instance of a content object in navigation history. Instead, Frame creates a new instance of the content object each time it is navigated to by using navigation history. This behavior is designed to avoid excessive memory consumption when large numbers and large pieces of content are being navigated to. Consequently, the state of the content is not remembered from one navigation to the next. However, WPF provides several techniques by which you can store a piece of state for a piece of content in navigation history, which include:
The following example shows how to create a simple Frame control and specify initial source content to load from a URI using the Source property.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.