In this article we will learn how to use Frame control in Silverlight 4.
The Frame is the control that will handle the validation and is the container for the Page control. A Frame can host one page at particular time.
Properties - These are the following properties of Frame control.
Source - this property provides the Uri of the page that will be opened in the frame, when the frame is loaded.
JournalOwnership - this property determines if the Frame should use its own journal or the one of the browser to store the navigation history. We'll take a look at it a little bit later.
Automatic - If the browser allows, the navigation history will be recorded in its journal, if not - it will be recorded only in the journal of the Frame control.
OwnsJournal - the Frame control will store the navigation history only in its own history journal.
UsesParentJournal - the Frame will use the journal of the parent Frame control and the JournalOwnership settings of the parent control are then applied. If there is no parent Frame control, the Browser History journal is used.
UriMapper property - This property provide a collection of URI patterns that map to Silverlight pages.
Creating a Frame control in XAML
<sdk:Frame Height="100" HorizontalAlignment="Left" Margin="10,10,0,0" Name="Frame1"
VerticalAlignment="Top" Width="200" />
The Width and Height attributes of the DataPager element represent the width and the height of a DataPager.
The default view of the DataPager control looks like this.
The Source property is set to /Views/Home.xaml which means that by default the page displayed in the frame is the page located at /Views/Home.xaml.
<Grid x:Name="LayoutRoot" Background="White">
<sdk:Frame x:Name="ContentFrame" Source="/Views/Home.xaml">
You can add new pages to your application by using the Add New Item dialog box and selecting Silverlight Page. The Silverlight Navigation Application template in Visual Studio creates a folder named Views that contains pages. You can add pages to this folder, or you can add pages anywhere in your application that is most appropriate.