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.

Dynamically rebuilding the virtual grid - can not remove the flicker

Thread ID:

Created:

Updated:

Platform:

Replies:

25249 Feb 22,2005 07:19 PM Mar 5,2018 06:26 AM Windows Forms 7
loading
Tags: GridControl
Igor Volnov
Asked On February 22, 2005 07:19 PM

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(); }

Administrator [Syncfusion]
Replied On February 22, 2005 09:21 PM

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();

Igor Volnov
Replied On February 24, 2005 02:22 PM

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.

Igor Volnov
Replied On February 24, 2005 02:25 PM

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

Administrator [Syncfusion]
Replied On February 24, 2005 02:49 PM

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

Igor Volnov
Replied On February 24, 2005 03:21 PM

Thanks a lot, it works fine.

sundar
Replied On March 4, 2018 02:01 AM

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

Sindhu Nagarajan [Syncfusion]
Replied On March 5, 2018 06:26 AM

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


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.

;