private Control CreateComboBox(object value, PropertyInfo property) { STComboBox comboBox = new STComboBox(); comboBox.Anchor = AnchorStyles.Right | AnchorStyles.Left; comboBox.Width = 300; comboBox.Dock = DockStyle.Fill; comboBox.SelectedIndexChanged += (sender, args) => { value = Enum.Parse(property.PropertyType, comboBox.SelectedItem.ToString()); }; comboBox.DataSource = Enum.GetValues(property.PropertyType); comboBox.DataBindings.Add(new Binding("SelectedItem", value, property.Name, false, DataSourceUpdateMode.OnPropertyChanged)); return(comboBox); }
private Control CreateComboBox(Controls.ComboBox comboBox) { STComboBox control = new STComboBox(); control.Anchor = AnchorStyles.Right | AnchorStyles.Left; control.Width = 300; control.Dock = DockStyle.Fill; control.SelectedIndexChanged += (sender, args) => { comboBox.SetValue(control.SelectedItem); }; foreach (var enumValue in comboBox.GetValues()) { control.Items.Add(enumValue); } control.SelectedItem = comboBox.SelectedValue; return(control); }