MaterialDesignInXamlToolkit icon indicating copy to clipboard operation
MaterialDesignInXamlToolkit copied to clipboard

Add bindable DP `TreeListView.SelectedItems`

Open corvinsz opened this issue 8 months ago • 4 comments

This adds a DP called SelectedItems to the TreeListView control. There was a small hurdle to overcome, because of the TreeListViews impl., which adds (when expanding) and deletes (when collapsing) childs. Bascially internally there are now 2 SelectedItems Lists:

  1. The base.SelectedItems (inherited from ListView) which only contains the visually selected items
  2. The SelectedItems (Dependency property) which always contains all of the selected items. This is the one the consumers see/use.

I also added tests for this new DP and showcases to the MD2&3 demos.

treeListViewSelectedItems

corvinsz avatar May 15 '25 11:05 corvinsz

The only thing left to solve is dealing with the correct selection of duplicate items. At least this is the last and only failing test (TreeListView_AddingDuplicateItemsAndSelectingWithArrowKeys_SelectsEachItemInTurn) you have added.

So far I was unable to find a solution for this. Keeping track of the selected items via reference (that's how it currently works) clearly doesn't work with duplicate items.

I was trying to make it work by keeping track of the selected item(s) via their index. This however also doesn't work since the TreeListView removes child nodes when collapsing a parent node. Maybe some kind of an internal data structure is the solution here? Help and opinions on this are welcome.

corvinsz avatar Jun 05 '25 15:06 corvinsz

This PR is marked stale because it has been open 60 days with no activity. Remove stale label or update the PR, otherwise it will be closed in 14 days.

github-actions[bot] avatar Aug 05 '25 02:08 github-actions[bot]

This PR was closed because it has been stalled for 14 days with no activity.

github-actions[bot] avatar Aug 20 '25 02:08 github-actions[bot]

This PR is marked stale because it has been open 60 days with no activity. Remove stale label or update the PR, otherwise it will be closed in 14 days.

github-actions[bot] avatar Oct 20 '25 02:10 github-actions[bot]

This PR is marked stale because it has been open 60 days with no activity. Remove stale label or update the PR, otherwise it will be closed in 14 days.

github-actions[bot] avatar Dec 20 '25 02:12 github-actions[bot]