Hi Andy,
The ComboBoxAdv''s ReadOnly property works precisely like any of the .NET controls'' ReadOnly property where it does not let you modify the existing value nor select a new value. However, for the above mentioned behavior in the ComboBoxAdv you would have to derive from our control and override the OnKeyPress, ProcessCmdKey and ProcessDialogKey methods as shown below :
protected override void OnKeyPress(KeyPressEventArgs e)
{
if (this.DroppedDown == false)
{
this.ReadOnly = true;
base.OnKeyPress(e);
this.ReadOnly = false;
}
else
base.OnKeyPress(e);
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (this.DroppedDown == false)
{
this.ReadOnly = true;
bool cachedValue = base.ProcessCmdKey(ref msg, keyData);
this.ReadOnly = false;
return cachedValue;
}
else
return base.ProcessCmdKey(ref msg, keyData);
}
protected override bool ProcessDialogKey(Keys keyData)
{
if (this.DroppedDown == false)
{
this.ReadOnly = true;
bool cachedValue = base.ProcessDialogKey(keyData);
this.ReadOnly = false;
return cachedValue;
}
else
return base.ProcessDialogKey(keyData);
}
I have also attached a complete
sample_application illustrating the above. Please refer to it and let me know if this meets your requirements.
Regards,
Guru Patwal
Syncfusion, Inc.