2 Replies - 8059 Views - Last Post: 06 June 2012 - 11:33 AM

#1 MarmiteX1  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 159
  • Joined: 17-October 09

Hyperlink button - Replicate Anchor tag like effect in Silverlight

Posted 06 June 2012 - 08:16 AM

Hi there,

I am using Silverlight and C#. I have 3 hyperlink buttons and 3 textblocks. I have a ViewModel which I bind a property to each of the hyperlink buttons. I would like to replicate the effect of an anchor tag in xhtml. So when you click on a link it will take you to that section/textblock e.g if you click on Admin, I would like to jump to the Admin Textblock.

How could i go about achieving this? I've attempted to do this but I am finding it difficult. If anyone could look at my code please and assist me it would be much appreciated.

Here is my code:
<StackPanel Grid.Row="1" Margin="0 2 0 2" Grid.ColumnSpan="2" Orientation="Horizontal">
<HyperlinkButton Content="{Binding MyiewModel.AdminCount, StringFormat='\{0\} x Admin'}" Foreground="Blue" />
<TextBlock Text=" - " />
<HyperlinkButton Content="{Binding MyViewModel.SalesCount, StringFormat='\{0\} x Sales'}" Foreground="Blue" />
<TextBlock Text=" - " />
<HyperlinkButton Content="{Binding MyViewModel.FinanceCount, StringFormat='\{0\} x Finance'}" TargetName="ContentFrame" 
Tag="{Binding MyViewModel.FinanceCount}" NavigateUri="" Foreground="Blue" />
</StackPanel>

<Textblock Content="Admin " />
<Textblock Content="Sales" />
<Textblock Content="Finance" />


This post has been edited by MarmiteX1: 06 June 2012 - 08:17 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Hyperlink button - Replicate Anchor tag like effect in Silverlight

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,960
  • Joined: 21-March 08

Re: Hyperlink button - Replicate Anchor tag like effect in Silverlight

Posted 06 June 2012 - 09:08 AM

This looks to do exactly what you want...

http://stackoverflow...g-functionality
Was This Post Helpful? 0
  • +
  • -

#3 MarmiteX1  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 159
  • Joined: 17-October 09

Re: Hyperlink button - Replicate Anchor tag like effect in Silverlight

Posted 06 June 2012 - 11:33 AM

Thanks, that looks like what i would like to do :)

I am using MVVM design and i was wondering how i could go about using that method which was outlined in that post?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1