I have got an Expand Grid and i currently allow a single-click sorting on column header. However, everytime i click on the header, all the nodes of my grid collapsed which makes it very annoying. I tried to catch the header clicking event in cell click (when rowIndex == 0) and assign a flag to cancel RowCollapsing event (e.Cancel = m_sorting ,where m_sorting set to true after column header click), but it doesn''t work. I wonder if there''s any event handling specifically designed for sorting? many thanks
ADAdministrator Syncfusion Team April 21, 2004 03:42 PM
The problem is that when the Sort is done using the DataView (which is how the GridDataBoundGrid sorts things), it triggers a ListChanged event with type Reset. This Reset is what forces the grid to collapse the nodes.
If you use the 2.0 GroupdingGridControl, this will not be a problem. The nodes will not collapse when you sort.
If you want try to handle this in the GridDataBoundGrid, it does take some effort. Here is a sample. It adds a new property in a derived grid that adds away to feeze the screen painting through a Win32 API call. This techique is discussed in one of our Windows Forms FAQ,