Represents a button control that displays a hyperlink.
Namespace:
System.Windows.Controls
Assembly:
System.Windows (in System.Windows.dll)
Visual Basic (Declaration)
<TemplateVisualStateAttribute(Name := "Pressed", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "MouseOver", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Disabled", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Focused", GroupName := "FocusStates")> _
<TemplateVisualStateAttribute(Name := "Normal", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Unfocused", GroupName := "FocusStates")> _
Public Class HyperlinkButton _
Inherits ButtonBase
Dim instance As HyperlinkButton
[TemplateVisualStateAttribute(Name = "Pressed", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "MouseOver", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Disabled", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Focused", GroupName = "FocusStates")]
[TemplateVisualStateAttribute(Name = "Normal", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Unfocused", GroupName = "FocusStates")]
public class HyperlinkButton : ButtonBase
XAML Object Element Usage
When clicked, the HyperlinkButton allows users to navigate to an external Web page or content within the same Silverlight application. You set the URI for the HyperlinkButton with the NavigateUri property. If the URI is set to an external Web page, you can specify the target window or frame that the page should open in with the TargetName property. If the URI is set to content within the same application, you can specify the name of the object to navigate to with the TargetName property. You do not have to handle the click event for the HyperlinkButton to automatically navigate to the value specified for the NavigateUri.
Note: |
|---|
If EnableNavigationon the Silverlight object is set to none, the user can only navigate to a relative URI in the current application. Attempts to navigate to an external URL will cause a SecurityException. |
The HyperlinkButton is a content control. Its content property is Content. For more information, see Control Content Models.
The following illustration shows a HyperlinkButton.
HyperlinkButton Control
.png)
Customizing the HyperlinkButton Control
To apply the same property settings to multiple HyperlinkButton controls, use the Style property. To change the visual structure and visual behavior of a HyperlinkButton, copy and modify its default style and template. For more information, see Control Customization.
If a dependency property for a HyperlinkButton is set by its default style, the property might change from its default value when the HyperlinkButton appears in the application. For more information, see Dependency Property Value Precedence. You can get the default style and template for HyperlinkButton from HyperlinkButton Styles and Templates.
The following code example demonstrates a HyperlinkButton. Click the hyperlink to open an external Web page in a new blank window.
Run this sample
<HyperlinkButton Content="Click here to learn about Silverlight"
NavigateUri="http://www.silverlight.net" TargetName="_blank" Margin="10,60,0,0"/>
System..::.Object
System.Windows..::.DependencyObject
System.Windows..::.UIElement
System.Windows..::.FrameworkElement
System.Windows.Controls..::.Control
System.Windows.Controls..::.ContentControl
System.Windows.Controls.Primitives..::.ButtonBase
System.Windows.Controls..::.HyperlinkButton
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Reference
Other Resources