We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Allow user to drag column from GridGroupingControl to remove from table

Thread ID:

Created:

Updated:

Platform:

Replies:

94064 Apr 20,2010 02:22 PM UTC Apr 28,2010 02:19 PM UTC WinForms 1
loading
Tags: Grouping
Jeff King
Asked On April 20, 2010 02:22 PM UTC

Hi,

I'm having trouble figuring out how to allow the user to drag a column from a GridGroupingControl off the control in order to remove it.

I want it to work the same as in Outlook when you drag a column header off the grid.

I saw the post here:
http://www.syncfusion.com/support/forums/grid-windows/53250/How-to-Remove-a-Column-from-Visible-Columns-Collection-by-Dragging-its-Column-Header-from-GridGroupingControl

however the link with the sample app is broken?

Thanks

Christopher Issac Sunder K [Syncfusion]
Replied On April 28, 2010 02:19 PM UTC

Hi Jeff,

Thank you for your interest in Syncfusion products.

Your mentioned requirement can be achieved by handling the Tablecontrol_mouseUp and TableControl_MouseDown events in GridGroupingControl. The TableControl_MouseDown is used to catch the HeaderColumn and that retrieved column is removed by calling the Tablecontrol_mouseUp whether the mouse pointer is not in the column header.


GridColumnDescriptor col = new GridColumnDescriptor();
void TableControl_MouseDown(object sender, MouseEventArgs e)
{
GridTableControl tableControl = sender as GridTableControl;
GridTableCellStyleInfo style = (GridTableCellStyleInfo)tableControl.PointToTableCellStyle(new Point(e.X, e.Y));
Point pt = tableControl.PointToClient(Control.MousePosition);

if (style.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.ColumnHeader)
{
col = style.TableCellIdentity.Column;
}
}

void TableControl_MouseUp(object sender, MouseEventArgs e)
{
GridTableControl tableControl = sender as GridTableControl;
GridTableCellStyleInfo style = (GridTableCellStyleInfo)tableControl.PointToTableCellStyle(new Point(e.X, e.Y));
Point pt = tableControl.PointToClient(Control.MousePosition);

if (style.TableCellIdentity.DisplayElement.Kind != DisplayElementKind.ColumnHeader && col!=null)
{
this.gridGroupingControl1.TableDescriptor.VisibleColumns.Remove(col.ToString());
}
col = null;
}


Please refer the sample link which allows user to drag column from GridGroupingControl to remove from table.

http://help.syncfusion.com/support/samples/Grid.Windows/8.2.0.18/F94064.zip

Please let me know if you have any further concerns

Regards,
Christopher K.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;