NavigationStarting event
TOC
Collapse the table of content
Expand the table of content

WebView.NavigationStarting event

[ Updated for UWP apps on Windows 10. For Windows 8.x articles, see the archive ]

Occurs before the WebView navigates to new content.

Syntax


public:
event TypedEventHandler<WebView, WebViewNavigationStartingEventArgs>^ NavigationStarting {
   Windows::Foundation::EventRegistrationToken add(TypedEventHandler<WebView, WebViewNavigationStartingEventArgs>^ value);
   void remove(Windows::Foundation::EventRegistrationToken token);
}


<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 (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

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

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

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:
© 2016 Microsoft