WPF: Get child objects click-event with disabled parent object
How can I get a click-event of a control if the controls parent is disabled?
Sample: We have a disabled GridViewColumnHeader so the user will be unab开发者_如何学Gole to move and resize the column. But still the user should be able to click the column header to sort the column content. But once the Header is disabled we do not get any click-events at all. Not from the header itself and not from any of children inside the header.
Instead of disabling the entrire header (which will, as you've seen, disable its children), you will want a solution to prevent resizing. The easiest way to do this is by redefining the template of the header.
Essentially, you want to remove the template part PART_HeaderGripper.
Take a look here for an example.
精彩评论