views:

30

answers:

1

Simplely derived from GridViewColumnHeader without styling,

class SampleHeader : GridViewColumnHeader {}

and use it like:

<StackPanel Orientation="Horizontal">
  <SampleHeader Content="Col1" />
  <SampleHeader Content="Col2" />
</StackPanel>

Very simple, but in runtime, the thumb cursor will not change to resizing cursor.

I try to use the standard one, it works correctly, now i had to run a dummy once to make the correct resizing cursor fired in SampleHeader.

Is it a bug or else ?

A: 

Yeah, it appears to be a bug. There's a code in the GridViewColumnHeader's private GetCursor(int) method that retrieves the SplitCursor by doing something like this:

Assembly assembly = base.GetType().Assembly;
...
cursorStream = assembly.GetManifestResourceStream("split.cur");

This is supposed to get the split cursor from the PresentationFramework.dll assembly (which contains the GridViewColumnHeader class).

When you derive from it though, the call to "base.GetType().Assembly" will return the Assembly containing your derived class, and therefore will not find the split cursor. Thus, the cursor will not change when you hover over the thumb. Yet, the (invisible) splitters are still draggable though.

karmicpuppet
Thank you karmicpuppet !