Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Possible bug in System.Windows.Controls.Primitives.MultiSelector class

$
0
0

With reference to this issue at CodePlex - https://wpfextendeddatagrid.codeplex.com/workitem/1065

I am reasonably certain there is a bug that prevents items that have value equality - as expressed through an override of "Equals" - but not reference equality - from being removed from the SelectedItems property even if IList.RemoveAt is called with the proper item index.

  1. To recreate this, go to the above link and download both attachments.
  2. Download the source code for the project reference above (Extended Data Grid).
  3. Replace "DataGrid.cs" in the Extended Data Grid project with the "DataGrid.cs" file in DataGrid.zip that is attached to the issue.
  4. Build the Extended Data Grid Project.
  5. Use the resulting ExtendedGrid.dll to build the project that is attached to the issue as a demonstration.
  6. Use the exe from the issue demo project as the debug executable for the Extended Data Grid project and Run.
  7. Press Load Test Data
  8. control-click two different items in the list that have the same text in the File Name column
  9. Set a breakpoint in the Extended Data Grid function "DataGrid.MakeFullRowSelection" at the point where EndUpdateSelectedItems is called.
  10. Now control-click the second selected item and note that even though that item should be removed from the SelectedItems collection, it is not.
As long as "Equals" returns nonequivalence for items in the SelectedItems collection, the item is removed, however, if the items are referentially different and .Equals returns equivalence, the deselected item is not properly removed.

Viewing all articles
Browse latest Browse all 18858

Trending Articles