Grid contextmenustrip disables column config menu
Hi,
a contextmenustrip assigned to the grid also shows up when right-clicking the header (instead of the of the column configuration popup menu). Is there a way to avoid this?
a contextmenustrip assigned to the grid also shows up when right-clicking the header (instead of the of the column configuration popup menu). Is there a way to avoid this?
0
-
We’ve added this feature explicitly because if a header doesn’t contain columns, there is no way to display them.
Therefore you can create your own implementation of the grid and change the default behavior:
public class CustomGrid : Grid
{
protected override void OnMouseDown(MouseEventArgs e)
{
if (Equals(e.Button, MouseButtons.Right))
{
switch (HitTest(e.Location))
{
case HitTestInfo.HeaderEmptyRight:
case HitTestInfo.HeaderGroupPanel:
case HitTestInfo.HeaderSelector:
return;
}
}
base.OnMouseDown(e);
}
}
Best regards,
The Dapfor Team0 -
Your support is great!
Thank you0
Please sign in to leave a comment.
Comments
2 comments