How to: Reorder an Action Container's Actions Collection 如何:重新排序按钮容器的按钮集合
In an XAF application UI, Actions are located within Action Containers. You can use the ActionBase.Category property and the Application Model's ActionDesign | ActionToContainerMapping node to move the Action to another Action Container (see Place an Action in a Different Location). This topic describes how to reorder Actions within a specific container.
在 XAF 应用程序 UI 中,操作位于操作容器中。您可以使用 ActionBase.Category 属性和应用程序模型的操作设计 |操作到容器映射节点以将操作移动到另一个操作容器(请参阅将操作放在其他位置)。本主题介绍如何对特定容器中的操作重新排序。
Presume you have the MyAction Action implemented in the MyController Controller. The ActionBase.Category property is set to View for this Action. This means that the Action is displayed within the View Action Container. This Container may also contain other Actions - custom Actions, and actions from referenced modules. To reorder Actions of the View Action Container (or any other Action Container), invoke the Model Editor for the WinForms, ASP.NET or Mobile application project. Locate the ActionDesign | ActionToContainerMapping | View node. The following image shows that there are three Actions in the View Action Container.
假定在"我的控制器"控制器中实施了"我的操作"操作。操作Base.类别属性设置为"查看此操作"。这意味着操作显示在视图操作容器中。此容器还可能包含其他操作 - 自定义操作和引用模块的操作。要重新排序视图操作容器(或任何其他操作容器)的操作,请调用 WinForms、ASP.NET或移动应用程序项目的模型编辑器。找到动作设计 |操作到容器映射 |查看节点。下图显示视图操作容器中有三个操作。
To reorder these Actions, change the Index property for each Action. For instance, use the "0" value for MyAction, "1" - for Refresh, "2" - for ExecuteReport.
要重新排序这些操作,更改每个操作的 Index 属性。例如,对 MyAction 使用"0"值,对"执行报告"使用"1" - 对于刷新,对执行报告使用"2"。"
If you run the application, you can ensure that the Actions order is changed as follows.
如果运行该应用程序,则可以确保按如下方式更改操作顺序。
Note 注意
Actions from the Unspecified Action Container can be displayed by another container if you change the IFrameTemplate.DefaultContainer value for the current Template. These Actions are appended to the end of the collection. If you need to change their position within the Container, then first specify their Action Container explicitly.
In the application with the TabbedMDI UI type (see MdiShowViewStrategy), the main window's Actions collection is merged with the child window's Actions, which can influence the resulting Actions order.
如果更改当前模板的 IFrameTemplate.Default容器值,则另一个容器可以显示来自"未指定操作容器"的操作。这些操作追加到集合的末尾。如果需要更改其在容器中的位置,请首先显式指定其操作容器。
在具有 TabbedMDI UI 类型的应用程序中(请参阅 MdiShowView 策略),主窗口的"操作"集合将与子窗口的操作合并,这可能会影响生成的"操作"顺序。
Tip 提示
To change Action Containers order and location, customize the Template. In WinForms applications, you can also use the runtime customization capabilities.
要更改操作容器的顺序和位置,请自定义模板。在 WinForms 应用程序中,您还可以使用运行时自定义功能。
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客户端