共用方式為


HtmlWindow.CurrentBookmark Property

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

Gets or sets a string that represents the hash value of the current page's URL.

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

Syntax

'Declaration
Public Property CurrentBookmark As String
public string CurrentBookmark { get; set; }

Property Value

Type: System.String
The hash value of the current page's URL. If the URL has no hash value, this property returns an empty string.

Exceptions

Exception Condition
ArgumentNullException

The return value is nulla null reference (Nothing in Visual Basic).

Remarks

This property updates the hash value found on the location object in JavaScript.

The property can be set to an empty string.

NoteNote:

You can provide the updated hash value with or without a number sign prefix. For example, you can specify "#xyz" or just "xyz".

For more information, see the location object in the dynamic HTML (DHTML) documentation.

Examples

The following code example demonstrates how to navigate to a bookmark.

CurrentBookmark = "#xyz";
CurrentBookmark = "xyz";

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.