HyperlinkButton Class
.NET Framework Class Library for Silverlight
HyperlinkButton Class

[Note: This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Represents a button control that displays a hyperlink.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
Syntax

'Usage

Dim instance As HyperlinkButton

'Declaration

<TemplateVisualStateAttribute(Name := "Normal", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Unfocused", GroupName := "FocusStates")> _
<TemplateVisualStateAttribute(Name := "Focused", GroupName := "FocusStates")> _
<TemplateVisualStateAttribute(Name := "Pressed", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Disabled", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "MouseOver", GroupName := "CommonStates")> _
Public Class HyperlinkButton _
    Inherits ButtonBase
<HyperlinkButton .../>
Remarks

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.

NoteNote:

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

Cc189259.SL_HyperlinkButton(en-us,VS.96).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.

NoteNote:

Setting a visual property will only have an effect if that property is both present in HyperlinkButton control's default template and is set by using a TemplateBinding. You can find a list of visual properties in the "Changing the Visual Structure of a Control" section of Customizing the Appearance of an Existing Control by Using a ControlTemplate.

Examples

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"/>
Inheritance Hierarchy

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
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms

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

See Also

Reference

Other Resources

© 2010 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View