question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TreeViewItem doesn't update IsSelected in SelectionMode=Multiple when clicking on Checkbox or content

See original GitHub issue

Describe 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:

  1. Clone XamlControlsGallery and update Microsoft.UI.Xaml to latest stable release (v2.0.181018003.1)
  2. Go to TreeViewPage.xaml under ControlPages.
  3. Go to third TreeView sample (A TreeView with DataBinding Using ItemSource)
  4. Add SelectionMode="Multiple" to TreeView
  5. Add IsSelected="{x:Bind IsSelected,Mode=TwoWay}" to the TreeViewItem
  6. Add Debug.WriteLine($"Selected changed: {value}"); to the set statement for IsSelected in the code-behind file. Include using statement for Debug.
  7. 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:open
  • Created 5 years ago
  • Reactions:8
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
MrDeejcommented, Feb 17, 2022

This is still a issue 17.02.2022. Please fix!

3reactions
lukedukeuscommented, Oct 3, 2022

How is this still an issue after four years? please fix it.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found