c# - Binding ObservableCollection to selected items of a ListBox -


after hours , hours of googling, still can't find simple solution binding observablecollection selected items of listbox in twoway mode...

what have simple : listbox selectionmode="multiple", , observablecollection<contact> named selectedcontacts. want 2 bound. of course listbox has itemssource="{binding contacts}" observablecollection of contact.

now can't use isselected bool on contact items, can't.

thank !

there is no simple solution. can't bind selecteditems.

the best solution select contact items view model object isselected property, bind that, , run query against primary oc when need selected items collection.

since said can't/won't that, next best solution handle selectionchanged in code-behind , manually update vm collection there.


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -