Scenes
Winform achieve reads xml configuration file and RadioGroup options ZedGraph dynamic configuration:
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/100540708
In the above realized after the RadioGroup options dynamically configured according to the configuration file,
Needs and obtain the value of the selected item based on the item code generation RadioGroup.
Note:
Blog home page:
https://blog.csdn.net/badao_liumang_qizhi
public concern number of
programs overbearing ape
acquisition-related programming e-books, tutorials and push for free download.
achieve
Each option is a RadioGroup a RadioGroupItem option.
Values and displayed values acquired when we checked in the use of a code generation RadioGroup, you need to set each Item show.
item.Description
It is the specific content of each item selected.
item.Value
Is the value of the value of each item.
item.Tag
It is used to access additional value.
The official explanation:
Gets or sets an object that contains custom data for the current RadioGroupItem object
Gets or sets an object that contains the current radiogroupitem custom data object.
Whole RadioGroup only one selected Radio, so set the selected item by default:
radioGroupX.EditValue = value The above value.
Select the entire RadioGroup get in other places of the value through
radioGroupX.Text
Obtain.
Sample code:
Generate RadioGroup
// generates a the radioGroup RadioGroup radioGroupX = new new RadioGroup (); the foreach (S TitleModel in XradioGrupItems) { // each button corresponding to the option unit Item RadioGroupItem Item = new new RadioGroupItem (); // Set the value of the option value item.Value = s.Title; item.Tag = s.TitleKey; // set the options described value, that value to be displayed item.description = s.Title; // enable option is enabled item.Enabled = to true; // add the option to the Items in radiogroup radioGroupX.Properties.Items.Add (Item); } // set the default value selected radioGroupX.EditValue = xAttribute.Title;
Take RadioGroup
xAxisModel.Title = radioGroupX.Text; xAxisModel.TitleKey =(string)radioGroupX.Properties.Items[radioGroupX.SelectedIndex].Tag;