We are using the following logic when there are no sortable columns in a grid:
layout.Override.HeaderClickAction = HeaderClickAction.Select;
layout.Override.SelectTypeCol = Infragistics.Win.UltraWinGrid.SelectType.None;
But the column headers are is still clickable, and will fire a Click event if defined on the grid.
Is there a way to completely disable the clickability of grid column headers?
Hello Richard,
Thank you for posting in our forum.
In order to completely disable the click action of an UltraGrid column’s header you may set Enable property of header to false. Please note you may need to set to appropriate values BackColorDisabled, ForeColorDisabled and etc. appearance properties of the header. Attached I am sending you a small sample solution implementing this approach.
Please let me know if this is what you are looking for or if I am missing something.
I implemented your solution, but the grid column headers are still selectable and clickable.
Hi Richard,
Just to be clear, you are saying that you have disabled the headers, and also set HeaderClickAction to Select and SelectTypeCol to None and yet clicking on a column header is still selecting the column?
The only reason that would happen is if something else is changing or overriding the properties after you set them. If you setting these properties on the grid's DisplayLayout.Override, then it's possible that they could be overridden on the Band.Override.
If that's not the case, then something else in your code must be re-setting some or all of these properties after you set them. This could happen by setting the properties directly, loading a layout, or loading a Preset. So you should check to see if your code is doing that.
What I am saying is that the column headers are still clickable and selectable with a mouse.
I have also verified that the header Enabled properties are not being re-enabled after they have been disabled (during the InitializeLayout event). A stop was placed in a column button click event, and the header Enabled properties are still set to false - HeaderClickAction and SelectTypeCol are also still set correctly.
Which event are you using for this? You said "column button click" event, but there is no such event that would apply to a column header. The Click event of the grid would still fire, of course.
If the header is disabled and the column is still getting selected, then something is wrong. I've never seen that happen, though. Can you post a small sample project that reproduces that behavior?
The event being used in not significant - the only purpose is to set a breakpoint that can be triggered at will to check the grid property values.
I have attached a sample project that demonstrates this behavior
I think maybe I am having a hard time understanding exactly what you want. Your post's title indicates you want to disable "click on grid header columns."
That's a little ambiguous - I'm not sure if you are trying to stop the click event from firing, or if you just want clicking on the headers to do nothing.
I ran your sample and clicking on the column headers isn't doing anything. No sorting or selection is taking place.
So what behavior are you concerned with here?
The only obvious behavior I see in your sample that involves the column headers at all is that they are showing a border when the mouse moves over them. Is that the issue? You don't want this highlighting?
If that's the issue, then you can turn this off by setting the HeaderStyle property on the Override. You can try the other styles to see which one you like, but I recommend the Standard Style, which has no highlighting.