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. Image for the cookie policy date

Dynamically rebuilding the virtual grid - can not remove the flicker

Hi, We are using virtual grid to display our data to users. Sometimes, the user would switch to a different dataset and then we need to modify the number of columns and populate them with different data. We want to stop Grid redrawing and QueryCellInfo events, modify the properties of columns and the underlying data source, and Resume redrawing and QueryCellInfo. We are trying to use BeginUpdate/EndUpdate, but this does not seem to work. Please help, whoever knows the answer. Thank you very much. Here is our source code: private void RebuildListGrid(...) { try { listViewGridControl.BeginUpdate(); // get the column info all_columns = GetColumnsInfo(); int size = all_columns.Count; listViewGridControl.ColCount = size; int frozen_count = GetFrozenColumnCount(); listViewGridControl.Cols.FrozenCount = frozen_count; listViewGridControl.BaseStylesMap["Standard"].StyleInfo.CellType = "Static"; RefreshListGridAppearance(); } finally { listViewGridControl.EndUpdate(); } } private void RefreshListGridAppearance() { listViewGridControl.ResetVolatileData(); listViewGridControl.UpdateScrollBars(); listViewGridControl.Model.ColWidths.ResizeToFit(GridRangeInfo.Cols(1,listViewGridControl.ColCount)); listViewGridControl.Refresh(); }

7 Replies

AD Administrator Syncfusion Team February 23, 2005 02:21 AM UTC

Something to try. In your RefreshListGridAppearance, comment out everything except the ResizeToFit call. Then in your finally block after the call to EndUpdate, add a call to listViewGridControl.Refresh();


IV Igor Volnov February 24, 2005 07:22 PM UTC

Did not help. First of all , it does not disply the correct number of records anymore. Secondly, I can still see how the grid is rebuild in two steps.


IV Igor Volnov February 24, 2005 07:25 PM UTC

Just to clarify, all_columns is a collection of ColumnInfo objects that specify information about columns. We use it from listViewGridControl_QueryCellInfo listViewGridControl_QueryColCount listViewGridControl_QueryRowCount


AD Administrator Syncfusion Team February 24, 2005 07:49 PM UTC

I suspect something in the code is turning off the BeginUpdate, and this is way you are seeing the flicker. There is another way you can freeze the painting. This technique works for any control and is discussed in one of our WIndows Forms FAQ. It adds aFreezePainting property to teh class that you can turn on and off. This technque has worked in situations where BeginUpdate is being cancelled for special reasons. Here is a forum thread that has teh references to the FAQ and includes a sample of how to use it. Maybe this technique will work for you. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=9290


IV Igor Volnov February 24, 2005 08:21 PM UTC

Thanks a lot, it works fine.


SU sundar replied to Igor Volnov March 4, 2018 07:01 AM UTC

Hi, We are using virtual grid to display our data to users. Sometimes, the user would switch to a different dataset and then we need to modify the number of columns and populate them with different data. We want to stop Grid redrawing and QueryCellInfo events, modify the properties of columns and the underlying data source, and Resume redrawing and QueryCellInfo. We are trying to use BeginUpdate/EndUpdate, but this does not seem to work. Please help, whoever knows the answer. Thank you very much. Here is our source code: private void RebuildListGrid(...) { try { listViewGridControl.BeginUpdate(); // get the column info all_columns = GetColumnsInfo(); int size = all_columns.Count; listViewGridControl.ColCount = size; int frozen_count = GetFrozenColumnCount(); listViewGridControl.Cols.FrozenCount = frozen_count; listViewGridControl.BaseStylesMap["Standard"].StyleInfo.CellType = "Static"; RefreshListGridAppearance(); } finally { listViewGridControl.EndUpdate(); } } private void RefreshListGridAppearance() { listViewGridControl.ResetVolatileData(); listViewGridControl.UpdateScrollBars(); listViewGridControl.Model.ColWidths.ResizeToFit(GridRangeInfo.Cols(1,listViewGridControl.ColCount)); listViewGridControl.Refresh(); }

dfffsdf


SN Sindhu Nagarajan Syncfusion Team March 5, 2018 11:26 AM UTC

Hi Igor, 
  
Please let us know whether you need any technical assistance. 
  
Regards, 
 Sindhu. 


Loader.
Live Chat Icon For mobile
Up arrow icon