前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >DevExpress.LookUpEdit控件实现自动搜索定位功能 兼使用方法(looUpEdit可编辑)

DevExpress.LookUpEdit控件实现自动搜索定位功能 兼使用方法(looUpEdit可编辑)

作者头像
乔达摩@嘿
发布2020-09-11 15:23:01
1.5K0
发布2020-09-11 15:23:01
举报
文章被收录于专栏:嘿dotNet嘿dotNet

DevExpress.LookUpEdit 使用方法

设置可手动输入

代码语言:javascript
复制
this.LookUpEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
代码语言:javascript
复制
  public static void LookUpbd(DevExpress.XtraEditors.LookUpEdit look, string sql,int display,int value)
        {
            DataTable dt = DAL.SqlDbhelp.GetDataSet(sql);
            look.Properties.SearchMode = DevExpress.XtraEditors.Controls.SearchMode.AutoComplete;
            look.Properties.DataSource = dt;
            look.Properties.DisplayMember = dt.Columns[display].ColumnName; //显示在文本框上的值
            look.Properties.ValueMember = dt.Columns[value].ColumnName; //获取的值
            look.Properties.NullText = "";
            look.Properties.SortColumnIndex = 0;
            look.Properties.ImmediatePopup = true;

        }

以下内容为转载

文章来源 http://blog.sina.com.cn/s/blog_6d1c583c01011qiv.html

详解DevExpress.LookUpEdit控件实现自动搜索定位功能

首先介绍三个重要的属性:

1. LookUpEdit.Properties.ImmediatePopup在输入框按任一可见字符键时立即弹出下拉窗体。

2. LookUpEdit.Properties.AutoSearchColumnIndex设置自动搜索的栏位序号,下拉窗体第一个栏位为0,依此类推,此属性配合SearchMode=OnlyInPopup时有效。

3. LookUpEdit.Properties.SearchMode 自动搜索定位模式

贴图图片
贴图图片

关于枚举类型SearchMode的定义:

C#Code: //Summary: // Enumerates search modes for a lookup edior. public enumSearchMode { // Summary: // The incremental search is enabled only when the dropdown window isopen. // If the window is closed, the user can modify the text in the editbox. However // these changes are ignored. // When the dropdown is open the incremental search is performedagainst the // column whose index is specified by theDevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit.AutoSearchColumnIndex // property. The header of this column contains the search icon(binoculars). // The user can click a specific column header to perform the searchagainst // this column. // The following screenshot shows a sample lookup editor. Theincremental search // is performed against the second column. OnlyInPopup = 0, // // Summary: // Enables the automatic completion feature. In this mode, when thedropdown // is closed, the text in the edit box is automatically completed ifit matches // aDevExpress.XtraEditors.Repository.RepositoryItemLookUpEditBase.DisplayMember // field value of one of dropdown rows. // When the dropdown is open, the automatic completion feature isdisabled but // the editor allows you to perform an incremental search in the samemanner // as when DevExpress.XtraEditors.Controls.SearchMode.OnlyInPopup modeis active. AutoComplete = 1, // // Summary: // Enables the incremental filtering feature. When you type within theedit // box, the editor automatically opens the dropdown window anddisplays only // records whoseDevExpress.XtraEditors.Repository.RepositoryItemLookUpEditBase.DisplayMember // field value starts with the characters typed. Other records are notdisplayed. // If you enter a value that does not match any record, the dropdownwindow // will not contain any rows. // The following image shows a lookup editor when AutoFilter mode isenabled. AutoFilter = 2, } //来源:C/S框架网(www.csframework.com)QQ:1980854898

OnlyInPopup :配合ImmediatePopup=True时使用,当用户在输入框按任一可见字符键时立即弹出下拉窗体,并跟据输入的字符从头部开始匹配AutoSearchColumnIndex属性指定栏位字段的值,第一个栏位为0.

特点:在下拉窗体能显示匹配结果(蓝底白字),但在输入框内不显示。

效果图如下:

贴图图片
贴图图片

AutoComplete:配合ImmediatePopup=True时使用,当用户在输入框按任一可见字符键时立即弹出下拉窗体,并在输入框自动完成您想要输入的数据,同时下拉窗体自动匹配最佳记录。AutoComplete模式仅匹配DisplayMember对应字段的值。

特点:能在输入框显示匹配的数据,并且下拉窗体显示匹配的记录。

效果图如下:

贴图图片
贴图图片

AutoFilter:配合ImmediatePopup=True时使用,当用户在输入框按任一可见字符键时立即弹出下拉窗体,并在输入框自动完成您想要输入的数据,同时下拉窗体自动过滤掉不匹配的记录。

特点:能在输入框显示匹配的数据,并过滤过不想要的记录。

贴图图片
贴图图片
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2014-09-09 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档