How to change the cursor to a hyperlink button?

Category: windows metro apps csharpvb


Osorio_Omar on Sat, 21 Apr 2012 17:01:27

Does anyone knows how to change the cursor property to a hyperlink button? I've tried doing it with "Cursor=Hand" in XAML but It just won't work.

<HyperlinkButton FontSize="16"Cursor="Hand" FontWeight="SemiBold" Tag="{Binding Link}" Click="HyperlinkButton_Click_1">-> Ver Detalles del Evento</HyperlinkButton>




Matt Small on Tue, 24 Apr 2012 20:43:41

Try this:

<HyperlinkButton FontSize="16"     FontWeight="SemiBold" Tag="{Binding Link}" Click="HyperlinkButton_Click_1" PointerEntered="HyperlinkButton_PointerEntered_1" PointerExited="HyperlinkButton_PointerExited_1">
-> Ver Detalles del Evento
private void HyperlinkButton_PointerEntered_1(object sender, Windows.UI.Xaml.Input.PointerEventArgs e)
	Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Hand,1);

private void HyperlinkButton_PointerExited_1(object sender, Windows.UI.Xaml.Input.PointerEventArgs e)
	Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 1);

Osorio_Omar on Tue, 24 Apr 2012 21:55:26

It doesn't work =/

Matt Small on Wed, 25 Apr 2012 01:47:05

It did for me.  What did it do for you?

StefanOlson on Fri, 11 May 2012 03:23:21


There is a bit of a problem with a solution that you propose.  If it's a control which then directs the user to another page, then the cursor never gets changed back from the hand,  because exited never gets called. and then you're wandering around the whole application using a hand cursor.  Obviously I could hack something into place, maybe by handling Unloaded?? But then the problem is  that I just don't know what other implications there are, maybe by the time unloaded gets called something else has happened  that has changed the cursor, and then I change it back to the wrong thing, who knows.

I think it's pretty important that the cursor property is available. I assume this is not a problem for people using HTML, only in XAML.  Would be nice to have consistency  where you could use either system  equally well.


Robert Sweeney - on Fri, 11 May 2012 04:24:15

I agree with Stefan.  I've had similar problems where the cursor gets stuck as a hand or whatever I changed it to.  Also, adding MouseEntered and MouseExited event handlers on every hyperlink button in your app is error prone.

Matt Small on Fri, 11 May 2012 13:11:40

I'll file a bug suggesting that HyperlinkButton should have the default cursor be a hand.

StefanOlson on Fri, 11 May 2012 18:05:50


Thanks, that is part of the answer.  However there are a lot of situations in my application where I need to use a hand cursor on something like a grid.  So the key is that there is a cursor property on all controls, as there is in HTML and WPF.  The question is can I hack my way round it and start using hyperlink button where I don't currently, maybe, but there may be some gotchas that I'm just not aware of that mean I can't do that and I'll still end up with these issues.


Rutger Rauws on Mon, 06 May 2013 20:47:31

Hi Matt,

Has there been any progress on this bug report? I'm still experiencing the same issue.

Thanks in advance!

Rob Caplan [MSFT] on Mon, 06 May 2013 22:11:44

Hi Rutger,

This is a feature request for the next version. There is no Cursor attribute for Windows 8 as Stefen requested. The only way to change the cursor is programmatically via the CoreWindow.PointerCursor property as Matt suggested.

You can wrap these calls in a behavior to address Robert Sweeney's comment about having to write custom code for every button. As Stefen suggests, you will want to handle other events to make sure the cursor change is undone. I'd probably start with capturing the pointer, but that may affect some underlying control behavior.