Share via


NavigatingCancelEventArgs.Uri Property

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

Gets the uniform resource identifier (URI) for the content that is being navigated to.

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

Syntax

'Declaration
Public Property Uri As Uri
public Uri Uri { get; private set; }

Property Value

Type: System.Uri
A value that represents the URI for the content.

Examples

The following example shows how to override the OnNavigatingFrom method and use the NavigatingCancelEventArgs object to determine if a child window is displayed.

Partial Public Class About
    Inherits Page

    Public Sub New()
        InitializeComponent()
    End Sub

    Protected Overrides Sub OnNavigatingFrom(ByVal e As System.Windows.Navigation.NavigatingCancelEventArgs)
        If (e.Uri.ToString().Contains("/Home")) Then
            Dim surveyChildWindow As New SurveyWindow
            surveyChildWindow.Show()
        End If

        MyBase.OnNavigatingFrom(e)
    End Sub
End Class
public partial class About : Page
{
    public About()
    {
        InitializeComponent();
    }


    protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
    {
        if (e.Uri.ToString().Contains("/Home"))
        {
            SurveyWindow surveyChildWindow = new SurveyWindow();
            surveyChildWindow.Show();
        }

        base.OnNavigatingFrom(e);

    }
}

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

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