I have a databound multiselect listbox bound to a datatable. When I select a listboxitem I want some other listboxitems in the same listbox to be selected automatically. I want multiple items to be selected with a single click. How can i do that? I can't do it in SelectionChanged
event because it leads to calling the same event again and breaks my logic altogether.
Please help. Any help will be highly appreciated.
UPDATE:
My listbox is already bound to a datatable which has a IsSelected column.I am using the value of this column in a style setter to make the listboxitem selected.Suppose i have 10 rows in the datatable.Now if the user selects the second listboxitem,i can get the isselected of the correspondong row in the database as 1.
But how can i get the other items to select at the same time? I think as Kent said,I rather use a property for binding. But how can i use a property to bind a listbox to a datatable?