Reputation: 1
In my app I have two pages: Main Page and Display Page. Each page has a browser control.
On Main Page the source of the browser control is set to a website's homepage. If the user touches a thumbnail, I want it to be shown on Display Page.
How do I grab the address of the link that has been clicked/touched and send it to the browser on Display Page?
Upvotes: 0
Views: 319
Reputation: 5557
WebBrowser
control has Navigating and Navigated Events.
In the Navigating handler, you can get the clicked link as e.Uri. get that and cancel the Navigation. then send that link to Display page.
void web_Navigating(object sender, NavigatingEventArgs e)
{
e.Cancel = true;
NavigationService.Navigate(new Uri("/DisplayPage.xaml?TargetUri="+e.Uri.ToString(), UriKind.Relative));
}
Note: By the way, sending the e.Uri is not a suggestible way. I would suggest you create a Static propety in the project and use that for sharing the links among pages.
Upvotes: 2