Binding textbox to multiple selected items in listbox

593 views Asked by At

I have two classes:

Class classA
{
   int intA { get; set; }
   classB B { get; set; }
}
Class classB
{
   int intB { get; set; }
}

The ListBox is binded to ObservableCollection from classA

public ObservableCollection<classA> listItems = new ObservableCollection<classA>();
itemsListBox.ItemsSource = listItems;

The ListBoxis using SelecteMode="Extended". Now, I have another textbox that is binded to the SelectedItem in the itemsListBox:

<TextBox Text="{Binding ElemantName=itemsListBox, Path=SelectedItem.B.intB}"/>

Everything here works fine but when I'm trying to edit the textbox when multiple items are selected in the listbox. Only the first selecteditem is being changed.

Any idea how can I fix it?

0

There are 0 answers