Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
Programmatically selection of nodes like UI selection with CTRL/SHIFT


We are currently reviewing various TreeView MultiSelection solutions to decide which one we will purchase (so I'm still using the trial version of Infragistics UI WPF).

I found out how to enable MultiSelection and select the individual nodes via the underlying ViewModels.

<ig:XamDataTree x:Name="DataTree" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" ItemsSource="{Binding Items}" IsSelectedMemberPath="IsSelected">

        public bool IsSelected
            get { return _isSelected; }
                if (_isSelected == value) return;
                _isSelected = value;


But unfortunately I had to find out that this selection behaves differently than the selection by mouse and UI.

If I select a node with the mouse and then another one, then only the second one is selected. The selection of the first node is removed.
If I select both and keep CTRL pressed, then both are selected.
So it works as expected.

If I select the two nodes one after the other via their IsSelected property, then both remain selected. Unfortunately the selection of the first node is not removed automatically.

Do I have to do this myself with your solution, or are there any other parameters I have to set to get a similar behavior as when selecting with the mouse combined/not combined with the CTRL key?

Thanks in advance.

  • 28530
    Offline posted

    Hello PSE,

    I have been investigating this issue that you are reporting, and I am under the impression that you are looking to have the programmatic selection of nodes only select multiple nodes if the CTRL or SHIFT keys are pressed. If this is the case, the current behavior is the expected behavior. Marking multiple nodes selected programmatically will not deselect other nodes that were marked selected.

    That said, you can programmatically deselect or get the nodes that are currently selected by using the XamDataTree.SelectionSettings.SelectedNodes collection. If you are looking to clear a selection at some point, just call Clear() on that collection and it will deselect all nodes.

    Please let me know if you have any other questions or concerns on this matter.