0

I read quite a few SO links and the 1000-page "Programming WPF" and things are not so working.

I have this in MainWindow.xaml

<Window.Resources>
    <Cursor x:Key="rightArrowCursor">Resources/im_pane</Cursor>
    <Style TargetType="DataGridRowHeader">
        <Setter Property="Cursor"  Value="{StaticResource rightArrowCursor}"/>
    </Style>

and im_pane.cur is added as existing file to Resources.

When the mouse is over DataGridRowHeader, I get exception:

XamlParseException: Failed to create a 'Cursor' from the text 'Resources/im_pane' ... Requested value 'Resources/im_pane' was not found.

I also tried Properties/Resource/im_pane, or im_pane.cur, still got the same error.

I just wonder how you use custom cursor in XAML?

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
ZZZ
  • 2,752
  • 2
  • 25
  • 37

1 Answers1

0

As Mentioned in http://theburningmonk.com/2010/03/wpf-loading-grab-and-grabbing-cursors-from-resource/

we can not directly define cursor in resourcedictionary you need to use dummy textblock and then need to use that cursor.

Ashok Rathod
  • 840
  • 9
  • 24