chrome
chrome

Reputation: 1161

How to specify a name for a "page" in Silverlight 3, with the Frame navigation control

I am using the Frame navigation control. Programmatically, I specify the page to fill the frame (like "Views\Home.xaml"). The browser is currently using string specified in the Frame control as the name of the page; in other words, the browser displays "Views\Home.xaml" as the name of the page.

I tried setting the "Name" property on the frame control, but that does not effect the name displayed by the browser.

Upvotes: 0

Views: 890

Answers (3)

Graeme Bradbury
Graeme Bradbury

Reputation: 3721

The Silverlight navigation framework consists of two main visual parts.

The System.Windows.Controls.Navigation.Frame which will host each page. Now the frame can host a UserControl but what it should be given is a page of type System.Windows.Controls.Navigation.Page which has a property on it called Title. The frame then uses the Title property as the title for the browser to use.

Upvotes: 0

Johannes
Johannes

Reputation: 1095

If you are using the navigation control, you do have access to (e.g. navigation:Page) and that contains a Title property.

Now, you say that you programmatically specify the page to fill the frame, however you do not specify if you are simply browsing there programmatically.

If you set up your UriMapper to contain something like the following:

<uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml" />

Then you can navigate to any page from the code-behind by simply using the Uri Format. For example:

ContentFrame.Navigate(new Uri("/About", UriKind.Relative));

will browse to /Views/About.xaml but will provide a page name of:

http://localhost:2568/FileDownloadNavigationTestPage.aspx#/About

Upvotes: 1

funwithcoding
funwithcoding

Reputation: 2412

Try setting the title property of the page.

Upvotes: 1

Related Questions