Silverlight Frame control in VB.NET

In this article we will learn how to use Frame control in Silverlight 4.
  • 2133

In this article we will learn how to use Frame control in Silverlight 4.

Frame control

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.

1.gif
 

Figure 1.

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.

2.gif

Figure 2.

For example

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.

<UserControl x:Class="SilverlightApplication32.MainPage"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400"xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

<Grid x:Name="LayoutRoot" Background="White">

        <sdk:Frame x:Name="ContentFrame" Source="/Views/Home.xaml">

</sdk:Frame>

</Grid>

</UserControl>

 

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.

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.