Home Forums WPF controls Xceed DataGrid for WPF How to asynchronously grouping on a virtualizing data view?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • freesonlee
    Participant
    Post count: 2
    #44760 |

    I am having issue that all my data query are asynchronous methods. While Xceed WPF DataGrid Data DataGridVirtualizingCollectionView.QueryGroups is a synchronous event that I have to return group key pair immediately. I would have to change a lot of code to make queries synchronous.

    Is there any other way or workaround to reuse my asynchronous queries?

    Thanks,
    Freeson

    Fawzi [Xceed]
    Member
    Post count: 722

    Hi,

    This is how virtualization works. However, there are two possible workarounds that may help in this regards:

    1. Wait for the next release of the DataGrid for WPF. In the next release, the DataGridVirtualizingCollectionView has been enhanced and provides a callback method that may be called asynchronously for the DataGridVirtualizingCollectionView.QueryGroups event.

    2. You may block the current thread (the thread that has raised the DataGridVirtualizingCollectionView.QueryGroups event) and start and handle your asynchronous queries on a background thread. The side effect of this solution is that the UI thread will be blocked, so the application will hang and look unresponsive if the queries are long.

    freesonlee
    Participant
    Post count: 2

    I think the thread that raised QueryGroups event is Main UI thread, is it?
    If so, I can’t block UI thread since it’s a TPL asynchronous task and it’s a WPF synchronization context application. Blocking UI thread will cause a deadlock, the background task callback posts action to dispatcher, which is already blocked.

    If there is no other way than upgrade to next release, maybe I have to change some code to use synchronous query to get groups…

    Curious that no one else complained this design?

    Fawzi [Xceed]
    Member
    Post count: 722

    Unfortunately, there is no other workarounds.

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