Frame control WPF in VB.NET

Here we will see that how to create Frame control and also explains the various property of the Frame control in XAML.
  • 5790

Here we will see that how to create Frame control and also explains the various property of the Frame control in XAML.

Frame control

The frame control displays the html content. The Frame control in WPF supports content navigation within content. A Frame can be hosted within a Window, NavigationWindow, Page, UserControl, or a FlowDocument control.

Creating Frame control in XAML

XAML code

<Frame Height="100" HorizontalAlignment="Left" Margin="10,10,0,0" Name="Frame1" VerticalAlignment="Top" Width="200"/>

 

The Width and Height attributes of the Frame element represent the width and the height of a Frame control.

Important Property

These are the some important 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 WPF pages.

For example

 

Now using Background source property of the frame control.

 

<Frame Height="169" HorizontalAlignment="Left" Margin="10,10,0,0" Name="Frame1" VerticalAlignment="Top" Width="317">

 <Frame.Background>

  <ImageBrush ImageSource="/WpfApplication83;component/Images/image1.jpg.gif" />

   </Frame.Background>

</Frame>

 

The window forms look like this.

 

frame1.gif

 

Frame1.gif

Using source property of the Frame control

The Source property is set to Page1.xaml which means that by default the page displayed in the frame is the page located at Page1.xaml.

Add a page in solution explorer and taking a label control on the form and add some text with the Label control.

Source="page1.xaml

 

The main page looks like this.


frame2.gif

 

Frame2.gif

 

Now run the application. the page1 content display in the main page.

 

frame3.gif


Frame3.gif

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.