详解DevExpress.LookUpEdit控件实现自动搜索定位功能
详解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时使用,当用户在输入框按任一可见字符键时立即弹出下拉窗体,并在输入框自动完成您想要输入的数据,同时下拉窗体自动过滤掉不匹配的记录。 特点:能在输入框显示匹配的数据,并过滤过不想要的记录。 20230715补充:
设置 AutoSearch,可以自动搜索全部列的资料。 C# Code: lue.PopupFilterMode = PopupFilterMode.Contains; lue.ImmediatePopup = true; lue.SearchMode = SearchMode.AutoSearch; //来源:C/S框架网 | www.csframework.com | QQ:23404761 效果图: 扫一扫加微信
参考文档:
开发应用-命令模式(C#实现POS收银功能) C# C/S框架高级搜索功能-接口设计 C/S开发框架标准版有版本自动升级功能吗? 基于C#.NET C/S快速开发框架 - 代码自动生成功能 C# 实现条码图片自动生成功能 C#.Net版本自动更新程序及3种策略实现 使用Scheduler控件实现生产进度监控程序 GridView实现自定义按钮及中间插入记录排序功能 C# GridView列头添加CheckBox控件实现全选功能 C#实现DevExpress控件换肤功能 C# 实现完整功能的截图控件(1)-实现绘图工具栏控件 (C#)RichTextBox控件查找文本演示(功能全) C#.NET C/S结构版本自动升级解决方案2.0详解 (一) CS框架网支持多关键字搜索功能(仅向VIP用户开放) .NET RichTextBox控件使用详解
其它资料:
什么是C/S结构? | C/S框架核心组成部分 | C/S框架-WebService部署图 | C/S框架-权限管理 | C/S结构系统框架 - 5.1旗舰版介绍 | C/S结构系统框架 - 功能介绍 | C/S结构系统框架 - 产品列表 | C/S结构系统框架 - 应用展示(图) | 三层体系架构详解 | C/S架构轻量级快速开发框架 | C/S框架网客户案例 | WebApi快速开发框架 | C/S框架代码生成器 | 用户授权注册软件系统 | 版本自动升级软件 | 数据库底层应用框架 | CSFramework.CMS内容管理系统 | |