Multiselect ListBox

ni3a picture ni3a · Jun 20, 2011 · Viewed 52.4k times · Source

I'm having trouble in multiple items selection in an ListBox.

I've tried deriving new control from Selector and writing ListBox helper class which did not work (as expected).

The issue with Selector class is, it does not expose SelectedItems and it's hell to bind the property and manipulate it with selection changed event.

The issue with ListBox Helper class is, I'm getting the required data on multiple selection but it never hits the bound property.

Does anybody know a better way to implement multiselect listbox?

Thanks in advance...

Answer

Adrian Fâciu picture Adrian Fâciu · Jun 20, 2011

The ListBox has multiple selection already implemented. Just change SelectionMode property to Multiple or Extened.

You can use SelectedItems property to get all the selected items afterwards.