该方案几乎适用与DevExpress中所有下拉控件(鼠标进入不会自动弹出下拉框的编辑框控件)
场景:
GridLookUpEdit设置TextEditStyle为Standard(允许输入)。
尝试在GotFocus事件与Enter事件中直接调用this.ShowPopup()方法,失败!
原因:进入/获取焦点后会打开下拉框,但随后焦点又回到编辑输入框,下拉框关闭。
解决方案:在Enter事件中添加以下代码:
protected override void OnEnter(EventArgs e)
{
base.OnEnter(e);
BeginInvoke(new Action(() => { this.ShowPopup(); }));
}
NB!
原文链接:https://www.devexpress.com/Support/Center/Question/Details/Q400997