Export (0) Print
Expand All
2 out of 4 rated this helpful - Rate this topic

HyperlinkButton.TargetName Property

Silverlight

Gets or sets the name of the target window or frame that the Web page should open in, or the name of the object within the Silverlight application to navigate to.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
'Declaration
Public Property TargetName As String
<HyperlinkButton TargetName="string"/>

Property Value

Type: System.String
Gets or sets the name of the target window or frame that the Web page should open in, or the name of the object within the Silverlight application to navigate to.

Dependency property identifier field: TargetNameProperty

When navigating to a location external to the current Silverlight application, the TargetName property corresponds to a standard HTML TARGET attribute. You can specify where the new content will be displayed when the user clicks the HyperlinkButton. The following table lists some target names and describes the results when they are used in the HyperlinkButton control.

Target

Description

_blank, _media, or _search

Loads the linked document into a new blank window.

_parent, _self, _top, or ""

Loads the page into the window in which the link was clicked (the active window).

When navigating to a location internal to the current Silverlight application, the TargetName should correspond to a x:Name Attribute for an object in the visual tree, which also implements the INavigate interface. The HyperlinkButton attempts to locate the target object. If an INavigate object with the TargetName is successfully located, the HyperlinkButton calls Navigate on the object, passing the NavigateUri as the URI parameter to that method. 

Version Notes

Silverlight for Windows Phone Silverlight for Windows Phone

In Silverlight for Windows Phone applications, you must specify a TargetName value for the application to properly navigate to the URI specified by NavigateUri.

The following code example demonstrates a HyperlinkButton. This code will open an external Web page in a new blank window.


<HyperlinkButton Content="Click here to learn about Silverlight"
    NavigateUri="http://www.silverlight.net" TargetName="_blank" Margin="10,60,0,0"/>


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

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

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

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.