I have a listbox that has its SelectionMode property set to Multiple.
Is it possible to bind the SelectedItem property to a List? and not to a single item?
Thanks
I have a listbox that has its SelectionMode property set to Multiple.
Is it possible to bind the SelectedItem property to a List? and not to a single item?
Thanks
You can use ListBox.SelectedItems property for this.
<ListBox x:Name="listBox" SelectionMode="Multiple" ItemsSource="{Binding YourCollection}" />
<ListBox ItemsSource="{Binding SelectedItems , ElementName=listBox}"/>
I've been using Samuel's solution for this and it works very well.
http://blog.functionalfun.net/2009/02/how-to-databind-to-selecteditems.html
I'm using this solution and it works great: http://alexshed.spaces.live.com/blog/cns!71C72270309CE838!149.entry