Associating a Listbox of a Favorite WPF List with a List

I have a list that has the SelectionMode property set to Multiple.

Is it possible to associate the SelectedItem property with a List? not one element?

thanks

+4
source share
2 answers

I use Samuel's solution for this and it works very well.

http://blog.functionalfun.net/2009/02/how-to-databind-to-selecteditems.html

+5
source

To do this, you can use the ListBox.SelectedItems property.

<ListBox x:Name="listBox" SelectionMode="Multiple" ItemsSource="{Binding YourCollection}" /> <ListBox ItemsSource="{Binding SelectedItems , ElementName=listBox}"/> 
+1
source

Source: https://habr.com/ru/post/1305343/


All Articles