I have a list of objects (consisting of an ID of type int and a String), each represent an option and corresponds to a radio box. I have an int selectedChoice
, and it stands for the ID of the selected radiobox, which represent an option. I want the int SelectedChoice
and the actual selected radio box binded to each other (two-way binding).
The radioboxes are added into the listbox using ItemTemplate and ItemsSource.
How can this be done? I've tried so many methods and no one works.
I have tried
- Converter (but it doesn't support binding in
ConverterParameter
) - Add a whole class which can identify the chosen radio box, and also carries the
int SelectedChoice
. But this method fails when converting back, as I don't get any necessary information that way. - Use
DependencyObject
, which fails when I'm trying to bind things to it, as there isn'tDataContext
inBinding.Converter
and workarounds I found on the Internet works for WPF only. IMultiConverter
which doesn't exist at all in SilverLight