Skip to main content
Home Forums General Silverlight New Features in Silverlight 3 Navigating from a Page's child UserControl
3 replies. Latest Post by Min-Hong Tang - MSFT on November 12, 2009.
(0)
WineNCheese
Member
3 points
3 Posts
11-07-2009 5:10 PM |
Hi, I've got a basic navigation scenario:
My MainPage (UserControl) contains a navigation frame and uri mapper.
One of the pages that can be displayed in the frame contains a child UserControl, which contains a HyperlinkButton.
In this HyperlinkButton, I would like to utilize the UriMappings from the MainPage. All attempts at doing this don't seem to work (setting or not setting the TargetName, etc).
Any suggestions?
I have no problems with HyperlinkButton's directly in the Page that contains the child UserControl.
Thanx
watabou
418 points
75 Posts
11-08-2009 12:24 AM |
I didn't knew navigation wasnt working on child window.
Whatever, you can do like this :
1. Create an EventHandler in Child Window2. Fire the event once hyper link button is clicked in Child Window3. In your Page.xaml hook up the submit event in Child Window4. Do the navigation directly in your page
11-08-2009 4:15 PM |
Thanx for the workaround thoughts. I'd like to know if there is a way to do it that isn't a workaround. And also, maybe an explanation why it doesn't work, if anybody's got that insight...
Min-Hong...
Contributor
3375 points
377 Posts
11-12-2009 1:29 AM |
Hi,
If you are saying you want to navigate in your child control's hyperlink button. Here is how i do it.
((MainPage)App.Current.RootVisual).ContentFrame.Navigate(new Uri(.....)); // add it in the hyperlinkButton's click event
Based on my understand, because the hyperlinkButton is in a discrete namescrope with the Frame object. So that is why you can not just use it as noraml. Here is a link about xaml namescope.
http://msdn.microsoft.com/en-us/library/cc189026(VS.95).aspx
According to this document quote "templates define their own XAML namescopes". And frame has it's own template.
Best Regards