User Tools

Site Tools



WPF - How to create and use a custom cursor in Xaml ?

Create a custom cur file ?

You can use gimp to do that.

  • Take a picture (32 * 32)
  • Export a ico file
  • Change the extension from ico to cur

Warning: Don't use a picture that is less of 32*32, in this case, resize the canvas of your picture to 32 * 32.

Integration in a WPF project

Instanciate the cursor as a resource :

      <Cursor x:Key="info-bulle">/Mainwindow.Modules;component/Images/info-bulle.cur</Cursor>

Use in a control

Every FrameworkElement has a Cursor property that is an instance of System.Windows.Input.Cursor.

<TextBox Cursor="{StaticResource info-bulle}" />

Resources :

technical_notes/public/20131021-wpf-create-custom-cursor.txt · Last modified: 2013/10/22 10:41 by Fabien Arcellier