开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜