Поделиться через


NavigationFailedEventArgs.Handled Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value that indicates whether the failure event has been handled.

Namespace:  System.Windows.Navigation
Assembly:  System.Windows.Controls.Navigation (in System.Windows.Controls.Navigation.dll)

Syntax

'Declaration
Public Property Handled As Boolean
public bool Handled { get; set; }

Property Value

Type: System.Boolean
true if the event has been handled; otherwise, false.

Remarks

When you have handled the exception and do not want the Silverlight framework to re-throw the exception, set the Handled property to true.

Examples

The following example shows a handler for the NavigationFailed event of the Frame class. When navigation to a page within the frame fails, a child window is displayed that contains an error message and the URI of the requested page. The code for the child window named ErrorWindow is not shown in this example, but must be included in the application for the example to work. The Handled property is set to true to indicate that the event has been handled and an exception should not be thrown.

Private Sub ContentFrame_NavigationFailed(ByVal sender As Object, _
         ByVal e As NavigationFailedEventArgs) Handles ContentFrame.NavigationFailed
    e.Handled = True
    Dim errorWindow As ChildWindow = New ErrorWindow(e.Uri)
    errorWindow.Show()
End Sub
private void ContentFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
    e.Handled = true;
    ChildWindow errorWin = new ErrorWindow(e.Uri);
    errorWin.Show();
}

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.