I have a ComboBox which I am placing in a SourceGrid3 control, but for some reason I can't set the Enabled attribute to true.
Here is my code.
ComboBox cboMyComboBox = new ComboBox();
cboMyComboBox.Enabled = true;
cboMyComboBox.BeginUpdate();
cboMyComboBox.Items.AddRange(new object[] { "Accept", "Reject" });
cboMyComboBox.EndUpdate();
cboMyComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
SourceGrid3.Cells.Real.CellControl thisControl = new SourceGrid3.Cells.Real.CellControl(cboMyComboBox);
myGrid[row, column] = thisControl;
(myGrid is the SourceGrid3 grid)
For some reason when the last line gets executed, the Enabled value gets turned to false and subsequent attempts to change it (like setting it back to true) don't have any effect.
Even if I try and change the value to true in the Visual Studio debugger, it won't allow it and simply changes it back to false. I have looked for a ReadOnly attribute for this field but there doesn't seem to be one (unless I'm missing something) besides I can change other attributes (like RightToLeft from No to Yes)
Is there anything else I can check that might cause this control to be forced to false ?
The Problem:
If a general Property which exists in all UI-Elements is set for a Control it will pass its value down to all child elements.
Speaking generally this will overwrite the Value of this property for all child controls.
The Solution:
Set the
Enabled-Property for yourGridtotrueand leave it unassigned in yourComboBoxor just remove theEnabled=falsein your grids definition.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With