TreeViewItem doesn't update IsSelected in SelectionMode=Multiple when clicking on Checkbox or content
See original GitHub issueDescribe the bug
When you have a TreeView
using ItemsSource
binding and set to SelectionMode="Multiple"
, the IsSelected
property is not changed when clicking on the checkbox. Also, the checkbox is not changed when clicking on the item, either.
Steps to reproduce the bug
Steps to reproduce the behavior:
- Clone XamlControlsGallery and update Microsoft.UI.Xaml to latest stable release (v2.0.181018003.1)
- Go to TreeViewPage.xaml under ControlPages.
- Go to third TreeView sample (A TreeView with DataBinding Using ItemSource)
- Add
SelectionMode="Multiple"
toTreeView
- Add
IsSelected="{x:Bind IsSelected,Mode=TwoWay}"
to theTreeViewItem
- Add
Debug.WriteLine($"Selected changed: {value}");
to theset
statement forIsSelected
in the code-behind file. Include using statement for Debug. - Run sample, go to TreeView page, and try clicking on the checkboxes, then the item contents instead.
Expected behavior
The debug output should show Selected changed: true
when the checkbox is checked and Selected changed: false
when unchecked. Also, the checkbox should be checked/unchecked when the content of the TreeViewItem
is toggled.
Screenshots
Version Info
NuGet package version: Microsoft.UI.Xaml v2.0.181018003.1
Windows 10 version:
- Insider Build (1809)
- October 2018 Update (17763)
- April 2018 Update (17134)
- Fall Creators Update (16299)
- Creators Update (15063)
- Anniversary Update (14393)
Device form factor:
- Desktop
- Mobile
- Xbox
- Surface Hub
- IoT
Additional context
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:17 (5 by maintainers)
Top Results From Across the Web
c# - WPF ItemsControl resetting IsSelected to false when I ...
I see the data propagate from the container to the viewmodel, and IsSelected updates. When I step through the code, immediately after it ......
Read more >Selection in WPF TreeView (SfTreeView)
When the selection mode is Multiple , programmatically select more than one item by adding the underlying object to the SelectedItems property.
Read more >How to pre-select a TreeView item in a DropDownBox
I have a DropDownBox, which is defined like this: .Editor(ed => ed.DropDownBox() .ShowClearButton(true) .AcceptCustomValue(false)
Read more >Tree view - Windows apps
SelectionMode property to allow selection of nodes. The TreeViewSelectionMode values are None, Single, and Multiple.
Read more >TreeView (JavaFX 8)
The SelectionModel provides the API through which it is possible to select single or multiple items within a TreeView, as well as inspect...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is still a issue 17.02.2022. Please fix!
How is this still an issue after four years? please fix it.