punker76 / gong-wpf-dragdrop

The GongSolutions.WPF.DragDrop library is a drag'n'drop framework for WPF
BSD 3-Clause "New" or "Revised" License
2.28k stars 400 forks source link

* Use MultiSelector's UnselectAll() method instead of iterating over … #486

Closed BerndHaidan closed 6 months ago

BerndHaidan commented 6 months ago

…the collection with items to deselect; This increases the performance significant!

e.g. for a DataGrid with 5.000 rows from > 3s to < 20ms

What changed?

Extension Method SetSelectedItem in ItemsControlExtensions.cs is adapted. Instead collect items to deselect and iterating over this collection, use UnselectAll() method.

To demonstrate the difference the DataGrid Sample is modified too.

An issue wasn't open yet.

punker76 commented 6 months ago

@BerndHaidan your changes have been merged, thanks for your contribution 👍

BerndHaidan commented 6 months ago

Was a pleasure. 😊 Thanks for publishing this really helpful library. 💪