Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

NavigationService.Navigate Method (Uri)

Navigate asynchronously to content that is specified by a uniform resource identifier (URI).

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

public bool Navigate (
	Uri source
)
public boolean Navigate (
	Uri source
)
public function Navigate (
	source : Uri
) : boolean
You cannot use methods in XAML.

Parameters

source

A Uri object initialized with the URI for the desired content.

Return Value

A Boolean value that is set to true if a navigation is not canceled; otherwise, false.

The value of source an be Web URL, or a valid pack URI (see Pack URIs in Windows Presentation Foundation).

Navigate will navigate to the URI specified by source if the following conditions are true:

  • The Navigating event is not cancelled.

  • A web request (see Navigating) can be created.

If source is a null reference (Nothing in Visual Basic), the existing content (Content) is cleared.

NoteNote:

When downloading Web content, you may receive a web exception (eg 404: File Not Found). You can handle such exceptions from NavigationFailed.

You can use Navigate to navigate to a content fragment. If the content identified by the URI is the current content, it is not downloaded again.

The following example shows how to navigate to a URI.

void goButton_Click(object sender, RoutedEventArgs e)
{
    this.NavigationService.Navigate(new Uri(this.addressTextBox.Text));
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

Show:
© 2014 Microsoft