winforms - Radio Buttons And Databinding in vb.net -


I have an object with some properties, one of which is CarpetColor I have my own There are three radio buttons ( rbRed , rbblue , rbGreen ) on a form within the container of

I know that How to do a simple binding where a control property is linked to an object property. I know that using the database to set the object's CarpetColor Want to I do not understand that there is a way to bind the result of three controls for a property. As an example, if the user clicks on 'red', then the value of the carpet color should be "red". Similarly, if it chooses 'Green', then the value of the color of the carpet should be changed to "Green".

Build a property on a form such as carpet carloor:

 < Code> Enum color {red, blue, green} color of the color of the public color ({RB Green checked? Green? Green: (RBR checked? Red: blue);} set {if (value == green ) RbGreen.Checked = true; otherwise if (value == red) rbr.selected = true; else rbBlue. Selected = true;}}   

and then you simply have carpet property on your form To the carpet of the data source

I will apply the form and will use the radio button events to increase incidents

  protected zero-non-transformable (string propertyName) {if (property Changed! = Null) {property changed (new propertyChangedEventArgs (propertyName));}} RbGreen.CheckedChanged + = (s, args) => OnPropertyChanged ("CarpetColor"); RbRed.CheckedChanged + = (S, Args) = & gt; OnPropertyChanged ("CarpetColor"); RBLE Checked Change + = (S, RGS) = & gt; OnPropertyChanged ("CarpetColor");    

Comments