ok here is the scenerio. treeview is setup with databinding on a parent-child relationship. data context is a viewmodel. using containerdatabindings to set IsSelected TwoWay. virtualization is set to True due to the number of records we are bound to. with virtulizing turned on, the issue shown below occurs. if we turn off virtualizing then the issue goes away, meaning only one item is selected at a time. we need to support multiple items being selected but only when user holds down Ctrl key.
as shown in the attached screen captures:
- expand parent
- click on a child item in parent to select it.
- collapse the parent
- click on another parent
- expand the original parent you had chosen
- you should now see two items selected in treeview. this is not ideal. there should only be the last item clicked on selected.
Is this by design of how virtualizing works or is this a bug? The treeview is supposed to unselect all selected items behind the scenes as you click on items, but that part seems to stop working on parents that have been collapsed. If we are going to use virtualizing, is there something we need to do in codehind to make sure only one item is selected at a time except if user is pressing Ctrl?