Home Forums WPF controls Xceed DataGrid for WPF DataGridVirtualizingCollectionView prevent page from flashing

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • magriff
    Participant
    Post count: 1
    #44207 |

    I develop an application that works with very large data sets stored in a local SQLite instance. One of the issues we are currently facing is every time a user adds/deletes items from the list in our large data set we trigger an IndexChanged event. Inside this index changed event we call DataGridVirtualizingCollectionView.Refresh()

    private void ViewModel_IndexChanged(object sender, EventArgs e)
    {
    ...
         this.view.Refresh();
    ...
    }

    This Refresh() call will trigger a QueryItemCount and QueryItems events to be triggered.

    Here is our QueryItemCount() event method

    private async void View_QueryItemCount(object sender, QueryItemCountEventArgs e)
    {
    	if (this.viewModel != null && this.viewModel.IsActive)
    	{
    		IList<Core.Sort> sortList = this.GetCurrentSort();
    
    		e.Count = await this.viewModel.GetItemCount(sortList);
    	}
    	else
    	{
    		e.Count = 0;
    	}
    }

    Here is our QueryItems() event

    private async void View_QueryItems(object sender, QueryItemsEventArgs e)
    {
    	if (this.viewModel != null)
    	{
    		var itemsList = await this.viewModel.GetPageAsObjects(e.AsyncQueryInfo.StartIndex, e.AsyncQueryInfo.RequestedItemCount);
    		e.AsyncQueryInfo.EndQuery(itemsList.ToArray());
    	}
    }

    My main question is this. Is there a way to prevent the page from getting cleared while the QueryItemCount and QueryItems are happening? Can DeferRefresh() be used? If so, how would DeferRefresh() be applied in this scenario? The main reason I ask this is because the user experience is not smooth, and the user will notice the page being cleared and then repopulated. I’d prefer for the page to not have this “flashing” effect.

    Thanks in advance for any help!

    Fawzi [Xceed]
    Member
    Post count: 722

    Hi,

    Unfortunately, since items are added and removed, a Refresh must be executed. And deferring the refresh will only postpone the refresh until you release it, and will have the same visual impact once executed.

    Diane [Xceed]
    Moderator
    Post count: 1353

    A fix was added in the latest version (DataGrid for WPF v6.3) that addresses this issue:
    “Refreshing data in a DataGridVirtualizingCollectionView no longer causes flickering in the DataGridControl for data items that do not change.”

    Download Link: http://forums.xceed.com/latest-xceed-datagrid-for-wpf

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.