What is the best way of binding a number of RadioButtons to an enum using MVVM?
The only way I can think of is binding each group box's IsChecked to a property, and in the setter of that property assign a value to an enum in the view model.
What is the best way of binding a number of RadioButtons to an enum using MVVM?
The only way I can think of is binding each group box's IsChecked to a property, and in the setter of that property assign a value to an enum in the view model.
You could display the Enum values in a ListBox and provide a special
ItemTemplate
with a RadioButton plus the name of the Enum. The RadioButton'sIsChecked
property could then be bound to the ListBoxItem'sIsSelected
property. Of course, you would have to set the ListBox'sSelectionMode
toSingle
.