will
will

Reputation: 4073

Using a Silverlight Hyperlink Button Style without the Navigation

In my page I want the button that looks like the HyperlinkButton (underline when MouseOver etc). But I want to handle the navigation in code (by using the Click event handler). So I'm using a HyperlinkButton and setting the NavigateUri to an empty string and setting the Click handler.

But the problem is that the browser tried to download the entire .xbap as a file download, presumably the empty NavigateUri mean "root".

Is there any way I can re-use the HyperLinkButton class (for visuals) but perform the actual navigation / or action in the Click method.

Upvotes: 0

Views: 1730

Answers (1)

vortexwolf
vortexwolf

Reputation: 14037

  1. Open expression blend.
  2. Right click on hyperlink button -> Edit style -> Edit copy
  3. Change TargetType="HyperlinkButton" to TargetType="Button"
  4. Use this style with any button.

Also, I have no problem with code

<HyperlinkButton Content="HyperlinkButton" Click="hb_Click"/>

Upvotes: 4

Related Questions