WebView.NavigationStarting event

Applies to Windows and Windows Phone

Occurs before the WebView navigates to new content.

Syntax


public event TypedEventHandler<WebView, WebViewNavigationStartingEventArgs> NavigationStarting


<WebView NavigationStarting="eventhandler" />

Event information

Delegate TypedEventHandler<WebView, WebViewNavigationStartingEventArgs>

Remarks

You can cancel navigation in a handler for this event by setting the WebViewNavigationStartingEventArgs.Cancel property to true.

WebView navigation events occur in the following order:

Similar events occur in the same order for each iframe in the WebView content:

Examples

The following code example demonstrates how to handle this event to update a text box used as an address bar. For the complete example, see the XAML WebView control sample.


void webView1_NavigationStarting(WebView sender, WebViewNavigationStartingEventArgs args)
{
    string url = "";
    try { url = args.Uri.ToString(); }
    finally
    {
        address.Text = url;
        appendLog(String.Format("Starting navigation to: \"{0}\".\n", url));
        pageIsLoading = true;
    }
}


Requirements

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

See also

WebView
WebViewNavigationStartingEventArgs
XAML WebView control sample

 

 

Show:
© 2014 Microsoft