This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi There, Is that possible to make the SelectedItems (similar) bindable for DataGrid? I tried to use INotifyCollectionChanged notifier = SelectedItems as INotifyCollectionChanged; notifier.CollectionChanged += new CollectionChanged(notifier_CollectionChanged); from function notifier_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) to add the selected items to my own dependency property "SelectedRecords", and bind this to my view model. It is extremely slow if I have a lot of records. If you can make it bindable and use mode OneWayToSource, then perhaps it will be much fast... Thanks Gordon |
|
|
Hello Gordon As you are close to release, I would like to avoid making any changes where possible. Using your current approach seems suitable. When you sync up the collections, make sure not to clear the whole collection and build it up again - just use the event args to only add and remove the items that have been added or removed. If you are already doing this, binding directly to the SelectedItems property would have almost the same performance which would mean the performance is struggling somewhere else. Jason Fauchelle |
|
|
Hi Jason, You were right not to risk this especially when the release is soon. And We found an alternate solution for this release - put code behind the xaml and use SelectedItems directly for related operations. Even though this is a bit of deviation from the MVVM of our structure. So for version 6.0, can you make it bindable? Even use your suggestions, If I have thousands records and I want to select all or thousands of the records, we will have thousands of event comes and this will slows down dramatically. If it is bindable, at least, We don't need to deal with the events and omit one extra operations. Thanks Gordon |
|
|
Thanks Gordon I have added this to the list to consider. We'll work something out when you are able to upgrade. Jason Fauchelle |
|