详解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 enum SearchMode
       {
                // Summary:
        //     The incremental search is enabled only when the dropdown window is open.
        //     If the window is closed, the user can modify the text in the edit box. However
        //     these changes are ignored.
        //     When the dropdown is open the incremental search is performed against the
        //     column whose index is specified by the DevExpress.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 search against
        //     this column.
        //     The following screenshot shows a sample lookup editor. The incremental search
        //     is performed against the second column.

               OnlyInPopup = 0,
                //
        // Summary:
        //     Enables the automatic completion feature. In this mode, when the dropdown
        //     is closed, the text in the edit box is automatically completed if it matches
        //     a DevExpress.XtraEditors.Repository.RepositoryItemLookUpEditBase.DisplayMember
        //     field value of one of dropdown rows.
        //     When the dropdown is open, the automatic completion feature is disabled but
        //     the editor allows you to perform an incremental search in the same manner
        //     as when DevExpress.XtraEditors.Controls.SearchMode.OnlyInPopup mode is active.

               AutoComplete = 1,
                //
        // Summary:
        //     Enables the incremental filtering feature. When you type within the edit
        //     box, the editor automatically opens the dropdown window and displays only
        //     records whose DevExpress.XtraEditors.Repository.RepositoryItemLookUpEditBase.DisplayMember
        //     field value starts with the characters typed. Other records are not displayed.
        //     If you enter a value that does not match any record, the dropdown window
        //     will not contain any rows.
        //     The following image shows a lookup editor when AutoFilter mode is enabled.

               AutoFilter = 2,
       }



//来源:C/S框架网(www.csframework.com) QQ:1980854898



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

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

效果图如下:

贴图图片  


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

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

效果图如下:

贴图图片  

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

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


贴图图片  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值