I have a Dictionary<string,bool> and I want to databind this Dictionary to a MultSelection Listbox with the functionality that when I select/deselct an Itme in the Listbox the corresponding bool value gets changed in the Dictionary<string,bool>
Hi thanks a lot - to be honest: Probably I'm just stupid. I didnt find a solution.
I've tried now many ways to do this simple thing:
Having a list box populated with the keys of the dictionary <string,int>
Selecting items in the listbox
If an item "blabla" is selected or several items "blabla", "blablabla" are selected the corresponding dictionary item is set to "blabla",1 and "blablabla",1
If an item "blabla" is deselected or several items "blabla", "blablabla" are deselected the corresponding dictionary item is set to "blabla",0 and "blablabla",0
I recommend using an IList for the value of the Value of the ListBox and IEnumerable for its Data. Then handle the Change event of the ListBox and sync your desired Dictionary<> with the contents of the IList which is the Value.