WPF: How to bind RadioButtons to an enum?

Posted by Sam on Stack Overflow See other posts from Stack Overflow or by Sam
Published on 2008-12-29T11:35:00Z Indexed on 2010/04/26 6:53 UTC
Read the original article Hit count: 250

Filed under:
|
|
|

I've got an enum like this:

public enum MyLovelyEnum
{
  FirstSelection,
  TheOtherSelection,
  YetAnotherOne
};

I got a property in my DataContext:

public MyLovelyEnum VeryLovelyEnum { get; set; }

And I got three RadioButtons in my WPF client.

<RadioButton Margin="3">First Selection</RadioButton>
<RadioButton Margin="3">The Other Selection</RadioButton>
<RadioButton Margin="3">Yet Another one</RadioButton>

Now how do I bind the RadioButtons to the property for proper two-way-binding?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about radiobutton