Skip to main content

Microsoft Silverlight

Answered Question Navigation frame, how to set its sourceRSS Feed

(0)

karlssonkatrin
karlsson...

Member

Member

1 points

77 Posts

Navigation frame, how to set its source

Hi

I have one UserControl- 'MainPage'. MainPage contains a navigation:frame 'frm_Navigation' I don't have a source in my xaml code so the first time the Mainpage is displayd, the 'content area' is empty. I also have a treeview in mainpage which I use for navigation, this displays different pages in frm_Navigation. This works fine.

 What I now need to accomplish is that the content in navigation:frame must display different pages from time to time when its first initialized (the user should not need to click in the treeview). I need a method in my mainpage.cs that checks certain criteria and then displays the correct page in navigation:frame.

 I don't know how to accomplish this, I tried to simple run navigate

frm_Navigation.Navigate(uri); in MainPage straight after InitializeComponent, but it wont work.

Any suggestions?

 

paru
paru

Member

Member

164 points

28 Posts

Re: Navigation frame, how to set its source

Did you put the uri as absolute or relative?

this.Frame.Navigate(new Uri(goToPage, UriKind.Relative));

Thanks
Paru

--mark as answer if helped

karlssonkatrin
karlsson...

Member

Member

1 points

77 Posts

Re: Re: Navigation frame, how to set its source

I tried both

Relative is the one I use when the user clicks in the navigation menu. But in this scenario it throws  a null exception.

I tried absolute as well, wont work.

AustinLamb
AustinLamb

Member

Member

602 points

104 Posts

Microsoft
Answered Question

Re: Re: Navigation frame, how to set its source

There was a bug in the beta where calling Navigate() before Frame's Loaded event was raised would throw an exception - this has been fixed for release.

As a workaround, you should be able to set Frame.Source to the Uri of the Source page, even in InitializeComponent.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities