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.
Unfortunately, activation email could not send to your email. Please try again.

ColsMoved event doesn''t fire for GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

51585 Nov 8,2006 06:37 PM Nov 10,2006 01:09 AM Windows Forms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On November 8, 2006 06:37 PM

Hi,

I'm using Syncfusion 4.2, and I realize that TableModel.ColsMoved event doesn't fire for GridGroupingControl. And TableDescriptor.Columns.Changed event doesn't fire either when a column is moved.

Can someone please give me some suggestion, as I really need to find out the positions from/to which the columns are moved.

Thanks very much,
Frank

Administrator [Syncfusion]
Replied On November 9, 2006 04:56 AM

Hi,

Try handling the TableDescriptor.VisibleColumns.Changed event to detect the column changes in a grouping grid. Please try this and let me know if this helps.

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On November 9, 2006 08:44 AM

yep, this works. Thanks.

>Hi,

Try handling the TableDescriptor.VisibleColumns.Changed event to detect the column changes in a grouping grid. Please try this and let me know if this helps.

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On November 9, 2006 09:50 AM

Well, I don't seem to be able to cancel this event. I tried e.Cancel = true in both VisibleColumns.Changed and VisibleColumns.Changing events. Any suggestions?
Thank you.
Frank

Administrator [Syncfusion]
Replied On November 9, 2006 09:50 AM

Well, I don't seem to be able to cancel this event. I tried e.Cancel = true in both VisibleColumns.Changed and VisibleColumns.Changing events. Any suggestions?
Thank you.
Frank

Administrator [Syncfusion]
Replied On November 10, 2006 01:09 AM

Hi Frank,

One way you can do this is to handle a Changed event on the VisibleColumns collection and once again move the moved column items. You can handle the Changing event to find the Starting Index of the moving column on the grid. Here is a code snippet to show this.

//To subscribe the VisibleColumns.Changing event in Form.Load event
this.gridGroupingControl1.TableDescriptor.VisibleColumns.Changing +=new ListPropertyChangedEventHandler(VisibleColumns_Changing);

int iStartIndex = -1;
private void VisibleColumns_Changing(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)
{
//Find the Starting Index of the moving column
//If you want to do this in any one of the particular column(index) then you need to check e.Index == YourIndex.
iStartIndex = e.Index;
GridVisibleColumnDescriptorCollection columns = sender as GridVisibleColumnDescriptorCollection ;
columns.Changed +=new Syncfusion.Collections.ListPropertyChangedEventHandler(VisibleColumns_Changed);
}

private void VisibleColumns_Changed(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)
{
if( e.Action == ListPropertyChangedType.Move )
{
//unsubscribe the VisibleColumn event. to avoid the stack overflow except
GridVisibleColumnDescriptorCollection columns = sender as GridVisibleColumnDescriptorCollection ;
columns.Changed -=new ListPropertyChangedEventHandler(VisibleColumns_Changed);
columns.Changing -=new ListPropertyChangedEventHandler(VisibleColumns_Changing);

//Move the VisibleColumn once again..
columns.Move(e.Index,iStartIndex);

//subscribe the VisibleColumn.Changing event
columns.Changing +=new ListPropertyChangedEventHandler(VisibleColumns_Changing);
}
}

Best Regards,
Haneef

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.

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.

;