EN
Il contenuto non è disponibile nella lingua di destinazione, ma solo in inglese.

WebView.UnviewableContentIdentified event

Applies to Windows and Windows Phone

Occurs when the WebView attempts to download an unsupported file.

Syntax


public event TypedEventHandler<WebView, WebViewUnviewableContentIdentifiedEventArgs> UnviewableContentIdentified


<WebView UnviewableContentIdentified="eventhandler" />

Event information

Delegate TypedEventHandler<WebView, WebViewUnviewableContentIdentifiedEventArgs>

Remarks

The WebView control cannot host arbitrary file types, but you can handle this event and use the Launcher class to redirect the file to the browser or another app.

Examples

The following code example demonstrates how to handle this event to launch an external browser when the WebView control cannot render the target content. For the complete example, see the XAML WebView control sample.


void webView1_UnviewableContentIdentified(WebView sender, 
    WebViewUnviewableContentIdentifiedEventArgs args)
{
    appendLog(String.Format("Content for \"{0}\" cannot be loaded into webview. " +
        "Invoking the default launcher instead.\n", args.Uri.ToString()));

    // We turn around and hand the Uri to the 
    // system launcher to launch the default handler for it.
    Windows.Foundation.IAsyncOperation<bool> b = 
        Windows.System.Launcher.LaunchUriAsync(args.Uri);
    pageIsLoading = false;
}


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
WebViewUnviewableContentIdentifiedEventArgs
Launcher
XAML WebView control sample

 

 

Mostra:
© 2014 Microsoft