标签:text layout isp end pup rgs pop void 事件
基本设置,绑定数据
searchEdit.Properties.ValueMember = "ID"; searchEdit.Properties.DisplayMember = "Name"; searchEdit.Properties.DataSource = dt; searchEdit.Properties.Popup += Properties_Popup;
在popup事件中添加
private void Properties_Popup(object sender, EventArgs e) { TextEdit txt = (sender as IPopupControl).PopupWindow.Controls.Cast<Control>().FirstOrDefault(item => item is SearchEditLookUpPopup).Controls.Cast<Control>().FirstOrDefault(item => item is LayoutControl).Controls.Cast<Control>().FirstOrDefault(item => item is TextEdit) as TextEdit; if (txt.Tag != null) return; txt.Tag = "KeyDown"; txt.KeyDown += txt_KeyDown; } void txt_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { TextEdit txt = sender as TextEdit; SearchLookUpEdit lookUpEdit = (txt.TopLevelControl as PopupSearchLookUpEditForm).OwnerEdit as SearchLookUpEdit; GridView gv = lookUpEdit.Properties.View as GridView; gv.FocusedRowHandle = 0; lookUpEdit.ClosePopup(); } }
DevExpress SearchLookUpEdit使用回车选择首行数据
标签:text layout isp end pup rgs pop void 事件
原文地址:https://www.cnblogs.com/xyz0835/p/10899091.html