Answered by:
creating a simple BackButton with WebView in windows Metro

Question
-
HI guys,
I am trying to create a very basic Web browser (so to speak). It will just display web pages from buttons that users press using WebView. I want to create a simple GoBack() button like in C#:
webView.GoBack();
but can't seem to do it in Windows metro 2012; an suggestions?
thanks,
Marlon
but can't seem to do it?
Wednesday, August 8, 2012 5:05 PM
Answers
-
Hi,
There is no such function in WebView control. You need to use codes to achieve this.
You can sink the WebView.LoadCompleted event to track the URI that users navigate to and remember where they've been. Wire up the GoBack and GoForward buttons to call WebView.Navigate to move through this history.
Best regards,
JesseJesse Jiang [MSFT]
MSDN Community Support | Feedback to us
- Marked as answer by Jesse Jiang Tuesday, August 14, 2012 7:13 AM
Friday, August 10, 2012 8:14 AM
All replies
-
Hi,
There is no such function in WebView control. You need to use codes to achieve this.
You can sink the WebView.LoadCompleted event to track the URI that users navigate to and remember where they've been. Wire up the GoBack and GoForward buttons to call WebView.Navigate to move through this history.
Best regards,
JesseJesse Jiang [MSFT]
MSDN Community Support | Feedback to us
- Marked as answer by Jesse Jiang Tuesday, August 14, 2012 7:13 AM
Friday, August 10, 2012 8:14 AM -
Thanks Jesse,
But I am totally new at this. I am not sure what you mean by "wire up", and I am not sure how to delegate an event ( I assume that is what you are implying)
thanks
Marlon
Thursday, August 16, 2012 2:31 PM -
Hi marlon_1_1,
As Jesse says, you can maintain the list of the URIs wherever a user navigates to and navigate that page on the WebView using WebView.Navigate function, use a pointer to locate the current URI in the list and move it back and forth accordingly on the Back/Forward button press events.
To get the URI from the WebView use WebView.LoadCompleted event and checkout the arguments.
PS: "to wire up" is to register for an event using a delegate function that can be called when that event occurs, you can always refer to the WebView sample provided.
Hope it helps.
regards,
Yashpal S.
Monday, August 20, 2012 6:02 AM