Add an Item to the New Action 在新建按钮中增加一个条目
In this lesson, you will learn how to add an item to the New Action (NewObjectViewController.NewObjectAction). The Event business class from the Business Class Library will be used.
在本课中,您将学习如何在新建按钮(NewObjectViewController.NewObjectAction)中增加一个新的条目。将使用业务类库中Event类型。
Note 注意
Before proceeding, take a moment to review the following lessons.
在继续之前,请花点时间复习以下课程。
- Place an Action in a Different Location
- Add a Class from the Business Class Library and Use the Scheduler Module (XPO/EF)
- 将操作放置在其他位置
- 从商务舱库中添加类并使用计划程序模块 (XPO/EF)
The New Action's items are defined in the Application Model by child nodes of the CreatableItems node. So, to add an item to the New Action, it is necessary to add a child to the CreatableItems node. By default, business objects whose declarations are decorated by the CreatableItemAttribute or DefaultClassOptionsAttribute can be created via the New Action from any View. However, the Event class (added in the Add a Class from the Business Class Library (XPO) topic) has none of these attributes applied. This class is declared in the Business Class Library. Although it is possible to modify the library sources and recompile the library, it is more convenient to make customizations in the Application Model.
新操作的项在应用程序模型中由 CreatableItems 节点的子节点定义。因此,要将项添加到"新建操作"中,必须将子项添加到 CreatableItems 节点。默认情况下,其声明由 CreatableItem 属性或默认类选项属性修饰的业务对象可以通过任何视图中的"新操作"创建。但是,事件类(在从 Business 类库 (XPO) 主题添加类中添加)没有应用这些属性。此类在商务舱库中声明。尽管可以修改库源并重新编译库,但在应用程序模型中进行自定义更为方便。
-
Invoke the Model Editor by double-clicking the Model.DesignedDiffs.xafml file from the MySolution.Module project. In the tree view, navigate to the CreatableItems node. If you expand this node, you will see the items that correspond to the business classes used in your application. These items were generated because the DefaultClassOptions attribute is applied to the corresponding classes. To add another item, right-click the CreatableItems node, and choose Add... | CreatableItem.
-
通过双击"模型.设计Diffs.xafml"文件来调用模型编辑器。在树视图中,导航到可创建项节点。如果展开此节点,您将看到与应用程序中使用的业务类对应的项。生成这些项目是因为 DefaultClassOptions 属性应用于相应的类。要添加其他项目,请右键单击可创建项节点,然后选择"添加..."可克雷项。
-
For the newly created node, select "Event" in the ModelClass dropdown list. The Caption property will automatically be set to "Scheduler Event".
-
对于新创建的节点,在"模型类"下拉列表中选择"事件"。"标题"属性将自动设置为"计划程序事件"。。
-
Run the WinForms or ASP.NET application. Notice that the Scheduler Event item has been added to the New Action's dropdown list. This item allows you to create Event objects, when objects of another type are displayed in the List View. Also note that an image has already been assigned to this item.
-
运行 WinForms 或ASP.NET应用程序。请注意,计划程序事件项已添加到"新操作"的下拉列表中。当另一种类型的对象显示在列表视图中时,此项允许您创建事件对象。另请注意,图像已分配给此项目。
You can see the changes made in this lesson in the Model Editor invoked for the Model.DesignedDiffs.xafml file located in the Main Demo | MainDemo.Module project. The MainDemo application is installed in %PUBLIC%\Documents\DevExpress Demos 19.2\Components\eXpressApp Framework\MainDemo by default. The ASP.NET version is available online at http://demos.devexpress.com/XAF/MainDemo/
您可以在本课中为模型调用的模型编辑器中所做的更改。主演示模块项目。主演示应用程序安装在%PUBLIC%\Documents\DevExpress Demos 19.2\Components\eXpressApp Framework\MainDemo by default. The ASP.NET version is available online at http://demos.devexpress.com/XAF/MainDemo/
.
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客户端