This is a migrated thread and some comments may be shown as answers.

WPF RadGridView and BindingOperations.EnableCollectionSynchronization

3 Answers 107 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Emil
Top achievements
Rank 1
Emil asked on 13 Nov 2017, 12:04 PM
I need to know if WPF RadGridView works with BindingOperations.EnableCollectionSynchronization. If not what solution you are suggesting to iterate and update my collection from worker thread?

3 Answers, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 15 Nov 2017, 12:30 PM
Hello Emil,

If you provide RadGridView with a QueryableCollectionView source, it will wrap its Items collection around this view and custom functionality such as the BindingOperations.EnableCollectionSynchronization method will be used. It will not, however, provide such functionality out of the box.

I've attached a small sample project demonstrating how to update the underlying collection from a BackgroundWorker. Please let me know if you find it helpful. If that is not the case, please provide more details regarding your exact requirements so that I can better assist you.

I look forward to your reply.

Regards,
Dilyan Traykov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Emil
Top achievements
Rank 1
answered on 15 Nov 2017, 07:21 PM

Hey Dilyan,

Thanks for your answer, however this is not what I need. I am aware how to use dispatcher but this sample still add items on the main thread. I would like to be able to iterate and modify the collection from worker thread without the need to post it on the dispatcher. I would like to hear how I can use QueryableCollectionView with BindingOperations.EnableCollectionSynchronization. I am looking at Telerik source code and I can't find any use of BindingOperations.AccessCollection which leads me to the conclusion that you are not supporting synchronization using BindingOperations.EnableCollectionSynchronization. I might have older version of Telerik WPF UI. May be you added support for BindingOperations.EnableCollectionSynchronization recently? If you did, please tell me.

Thanks.

0
Dilyan Traykov
Telerik team
answered on 20 Nov 2017, 11:07 AM
Hello Emil,

As suggested in my last reply, RadGridView does not enable such support out of the box. You can, however, use your own implementation by providing the control with an QueryableCollectionView as its source. I'm attaching an updated version of the previous project to demonstrate this.

You can have a look at the following articles which I believe you will find helpful:

Observable Collection Cross-Thread Change Notification
Cross-Thread Collection Synchronization Redux

Please let me know if any further questions or concerns arise.

Regards,
Dilyan Traykov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Emil
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Emil
Top achievements
Rank 1
Share this question
or