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

Scrolling w/o Flicker in Virtual Grids

I''ve seen some other posts of people having problems with scrolling in virtual grids. I thought I''d post my solution to the problem in case it was useful to others. My virtual grid uses QueryCellInfo to set both text and styles. There''s logic to choose styles based on cell types/values; the styles have different BackColors. Furthermore, the "model" for the grid is optimized to only fetch data when everything is settled. The issue was that, when the "model" was invalid, it produced default values. The style selection logic kicked in--and what the user would see after, say, paging down, was a white cell turning gray and then white again. The gray was based on the temporary selection of a default value from an invalid model. My soltion was to call if (!m_DataEntryRefreshing) { m_DataEntryGrid.BeginUpdate( BeginUpdateOptions.None ); } in LeftColChanging/TopRowChanging, and then call try { RefreshDataEntryVisibleCells(); RefreshDataEntry(); } finally { if (!m_DataEntryRefreshing) { m_DataEntryGrid.EndUpdate( true ); } } in LeftCol/TopRowChanged. The try block protects against errors in my refresh code; the refresh code sets and clears the m_DataEntryRefreshing flag. The reason I check the flag is that under some circumstances the refresh code centers the currently selected column in the grid, thus causing a change (and call) to LeftCol. This took care of the last of my flicker problems.

Loader.
Live Chat Icon For mobile
Up arrow icon