There are several ListBox to which different collections bind. And there is a panel with properties where the user can edit the selected item. Therefore, you need to make that an item can be selected only in one of the ListBox .
I thought that if I made a property in which the selected object would be stored:
public BaseAction SelectedElement { get { return _selectedAction; } set { _selectedAction = value; OnPropertyChanged(); } } and make a binding to SelectedItem , then everything will work, because if ListBox does not find this item in itself, then there is nothing to select.
<ListBox ItemsSource="{Bindig UserActions}" SelectedItem="{Binding SelectedElement}" /> <ListBox ItemsSource="{Bindig GroupActions}" SelectedItem="{Binding SelectedElement}" /> But it did not work. When selecting an item in another ListBox item from the previous one does not lose the selection.
Tell me how to realize our plans?