How to: Add a Search Action to Lookup Property Editors and Link Pop-up Windows 如何:添加搜索按钮到查找属性编辑器和链接弹出窗口
If you have already run a Windows Forms or ASP.NET application, you might notice that Lookup Property Editors, which display reference properties, contain a list of existing objects of the specified type in the drop-down menu. Similarly, the Link Action's pop-up window displays a list of available objects of the specified type. The following image demonstrates both the Lookup Property Editor's drop-down window and the Link Action's pop-up window:
如果已运行 Windows 窗体或ASP.NET应用程序,您可能会注意到显示引用属性的查找属性编辑器包含下拉菜单中指定类型的现有对象的列表。同样,链接操作的弹出窗口显示指定类型的可用对象的列表。下图演示了查找属性编辑器的下拉窗口和链接操作的弹出窗口:
However, this approach to simultaneously show all objects, is not appropriate when there are many objects to be shown. So, the eXpressApp Framework supplies a built-in Search functionality. This topic details how to turn it on.
但是,当有许多对象要显示时,此方法同时显示所有对象是不适当的。因此,eXpressApp框架提供了一个内置的搜索功能。本主题详细介绍了如何打开它。
The Search functionality is activated in all Mobile applications and in WinForms and ASP.NET applications when a List View in a Lookup Property Editor or Link Action's pop-up window contains more than 25 objects by default. You can change this number. For this purpose, use the IModelOptions.LookupSmallCollectionItemCount property of the Application Model's Options node.
默认情况下,当"查找属性编辑器"或"链接操作"弹出窗口中的列表视图包含超过 25 个对象时,在所有移动应用程序中以及 WinForms 和 winForms 中激活搜索功能,并在 WinForms 和ASP.NET应用程序中激活搜索功能。您可以更改此号码。为此,请使用应用程序模型选项节点的 IModelOptions.查找小型集合项目计数属性。
This property specifies the minimum count of objects that should be in a List View to activate the Search functionality.
此属性指定列表视图中应具有激活搜索功能的对象的最小计数。
The Search functionality is provided by an editor and the Search button:
"搜索"功能由编辑器和"搜索"按钮提供:
This button executes the FilterController.FullTextFilterAction Action of the FilterController. This Action filters the List View's collection source, searching the objects whose properties' string representation includes the value specified by an end-user. The properties include those that are listed in the Views | <ListView> node defining the List View - no matter visible or invisible, persistent or non-persistent. For details, refer to the FilterController class description.
此按钮执行筛选器控制器.筛选控制器的全文筛选操作。此操作筛选列表视图的集合源,搜索其属性的字符串表示形式包括最终用户指定的值的对象。属性包括视图 |<ListView>定义列表视图的节点 - 无论是可见的还是不可见的、持久的还是非持久性的。有关详细信息,请参阅筛选器控制器类说明。
You can have the Search functionality available in the Lookup Property Editor or Link Action's pop-up window when any number of objects are contained in the List View's collection source. For this purpose, apply the LookupEditorModeAttribute to the required property (a reference of collection property). Using this attribute, you can set one of the following modes for the corresponding Lookup Property Editor or Link Action's pop-up window:
-
Auto
The Search feature is added if the presumed object count in its data source collection is greater than the value of the LookupSmallCollectionItemCount attribute.
-
AllItems
All objects of the specified type are loaded.
-
Search
None of the existing objects of the specified type are loaded, and the Search feature is available.
-
AllItemsWithSearch
All objects of the specified type are loaded, and the Search feature is available.
当列表视图的集合源中包含任意数量的对象时,您可以在"查找属性编辑器"或"链接操作"的弹出窗口中提供搜索功能。为此,将查找编辑器Mode属性应用于所需的属性(集合属性的引用)。使用此属性,可以为相应的查找属性编辑器或链接操作的弹出窗口设置以下模式之一:
- 自动
如果其数据源集合中的假定对象计数大于"查找小集合ItemCount"属性的值,则添加搜索功能。 - 所有项目
将加载指定类型的所有对象。 - 搜索
未加载指定类型的任何现有对象,并且搜索功能可用。 - 带搜索的所有项目
将加载指定类型的所有对象,并且搜索功能可用。
To set the required mode, pass the corresponding value as the LookupEditorModeAttribute's parameter. Alternatively, you can use the Model Editor. The value of the LookupEditorMode atribute's mode parameter is set for the LookupEditorMode property of the BOModel | <Class> | OwnMembers | <Member> node.
要设置所需的模式,将相应的值传递为查找编辑器模式属性的参数。或者,您可以使用模型编辑器。为 BOModel 的"查找编辑器模式"属性设置"查找编辑器模式"模式参数的值 |<Class>*自己的会员 |<Member>节点。
If the LookupEditorModeAttribute attribute is not used, the Lookup Property Editor is displayed in the Auto mode.
如果未使用"查找编辑器"属性,则"查找属性编辑器"在"自动"模式下显示。
XAF开发成品案例参考
如果您觉得阅读本文对您有帮助,请点一下“推荐”按钮,您的“推荐”将是我最大的写作动力!欢迎各位转载,但是未经作者本人同意,转载文章之后必须在文章页面明显位置给出作者和原文连接,否则保留追究法律责任的权利。
作者博客: http://www.cnblogs.com/foreachlife
欢迎加入CIIP框架\XAF技术应用交流群: 336090194 群文件中有更多相关工具及文档资料
转载请注明出处。多谢!
欢迎加我微信: admiralcn 或扫码:

【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 周边上新:园子的第一款马克杯温暖上架
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
· 使用C#创建一个MCP客户端