views:

100

answers:

2

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.

Any help is appreciated.

+1  A: 

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's IsChecked property could then be bound to the ListBoxItem's IsSelected property. Of course, you would have to set the ListBox's SelectionMode to Single.

gehho
Didn't thinks of that :) Will give it a try :D
LnDCobra