WPF DataGrid has erratic SelectAll performance #5588
-
This issue has been moved from a ticket on Developer Community. [severity:It's more difficult to complete my work] Example code below with comments. Also see the attached project.
Original CommentsFeedback Bot on 8/29/2021, 08:10 PM:We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps. Original Solutions(no solutions) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey, This is related to the difference between Another note: Hope this was helpful! |
Beta Was this translation helpful? Give feedback.
-
Hi , I am also facing same issue with class binding . I am using Observable collection of class instance . It's getting freeze while selecting more than 2k rows using ctrl +A . |
Beta Was this translation helpful? Give feedback.
Hey,
This is related to the difference between
class
andstruct
. DataGrid needs compare the items in ItemsSource very frequently. In the case of SelectAll, it needs to compare every item to a growing list to make sure that it doesn't select the same item twice. It gets exponentially slower the more items there are in the DataGrid. For classes, the comparison is extremely fast because it does so by comparing the reference of the two classes. For structs, it's a bit different since they are value types and therefore have no "reference". To compare two structs, it uses the Equals method. If the Equals method is not implemented in the struct, it will automatically do the comparison by compari…