// Subscribe and unsubscribe the control events protected override void OnSubscribeControlEvents(Control c) { // Call the base so the base events are connected. base.OnSubscribeControlEvents(c); // Cast the control to a DarkComboBox control. DarkComboBox combo = (DarkComboBox)c; // Add the event. combo.SelectedIndexChanged += new EventHandler(OnSelectedIndexChanged); }
protected override void OnUnsubscribeControlEvents(Control c) { // Call the base method so the basic events are unsubscribed. base.OnUnsubscribeControlEvents(c); // Cast the control to a DarkComboBox control. DarkComboBox combo = (DarkComboBox)c; // Remove the event. combo.SelectedIndexChanged -= new EventHandler(OnSelectedIndexChanged); }
protected override void OnCellEditStarting(CellEditEventArgs e) { if (e.Cancel) { return; } if (e.RowObject is IPropertyValue prop) { if (prop.Type != null && typeof(MBObjectBase).IsAssignableFrom(prop.Type)) { var cb = new DarkUI.Controls.DarkComboBox { Bounds = e.CellBounds, DropDownStyle = ComboBoxStyle.DropDownList, Sorted = false, }; cb.InitializeComboBox(type: prop.Type, value: e.Value as MBObjectBase); e.Control = cb; e.AutoDispose = true; return; } } base.OnCellEditStarting(e); }