Add an Item to the Navigation Control 将项目添加到导航控件
In this lesson, you will learn how to add an item to the navigation control. For this purpose, the Note business class from the Business Class Library will be used.
在本课中,您将学习如何将项添加到导航控件。为此,将使用商务舱库中的 Note 业务类。
Note 注意
Before proceeding, we recommend that you 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)
- If the Note class is not used as an ancestor in your code, you will need to add it to the UI generation process. To do this, use the Module Designer. In the Exported Types pane, focus the Referenced assemblies | DevExpress.Persistent.BaseImpl.v19.2 | Note item and press the space bar. Refer to the Add a Class from the Business Class Library (XPO) lesson for details.
-
The XAF application's navigation structure is defined by the NavigationItems node in the Application Model. To customize the navigation, invoke the Model Editor by double-clicking the Model.DesignedDiffs.xafml file in the MySolution.Module project. In the tree view, navigate to the NavigationItems | Items | Default | Items node. To add a child item to the required navigation item, right-click the Items node and select Add… | NavigationItem from the invoked context menu.
-
如果 Note 类在代码中未用作祖先,则需要将其添加到 UI 生成过程中。为此,请使用模块设计器。在"导出的类型"窗格中,聚焦引用的程序集 |开发快车.持久.BaseImpl.v19.2 |记下项目并按下空格键。有关详细信息,请参阅从商务舱库 (XPO) 中添加类课程。
-
XAF 应用程序的导航结构由应用程序模型中的导航项节点定义。要自定义导航,请通过双击"模型.设计Diffs.xafml"文件在 MySolution.模块项目中调用模型编辑器。在树视图中,导航到导航项 |项目 |默认值 |项目节点。要将子项添加到所需的导航项,请右键单击"项目"节点并选择"添加..."|从调用的上下文菜单导航项。
-
For the newly added node, select "Note_ListView" in the View dropdown list. The Caption property will automatically be set to "Note". Optionally, you can set a user-friendly Id value.
-
对于新添加的节点,在"查看"下拉列表中选择"Note_ListView"。"标题"属性将自动设置为"注意"。或者,您可以设置用户友好的 Id 值。
As you have seen, there are many ready-to-use Views available in the View dropdown list. These views are automatically generated based on business classes loaded to the Application Model. One of these classes is Note. So, you only need to add a corresponding View to the navigation items collection.
正如您所看到的,在"视图"下拉列表中有许多现成的视图可用。这些视图根据加载到应用程序模型的业务类自动生成。这些类之一是"注意"。因此,您只需向导航项集合添加相应的视图。
Note 注意
You can set shortcuts for navigation items via the Shortcut property. In this instance, you will not have to use a mouse to switch between Views, even if the navigation control is hidden via the View | Panels | Navigation | Hidden menu item.
您可以通过快捷方式属性为导航项设置快捷方式。在这种情况下,您不必使用鼠标在视图之间切换,即使导航控件通过视图隐藏 |面板 |导航 |隐藏的菜单项。
-
Run the WinForms or ASP.NET application. You now have an additional navigation item that allows you to add and edit plain text notes. Also note that this item already has an image assigned.
-
运行 WinForms 或ASP.NET应用程序。现在,您有一个允许您添加和编辑纯文本注释的其他导航项。另请注意,此项目已分配了图像。
Note 注意
When you define a business class in your application, you can apply the DefaultClassOptionsAttribute or NavigationItemAttribute attribute instead of using the Application Model. See the Inherit from the Business Class Library Class (XPO) lesson.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.
在应用程序中定义业务类时,可以应用默认类选项属性或导航项目属性属性,而不是使用应用程序模型。请参阅从业务类库类 (XPO) 课程继承。您可以在本课中为模型调用的模型编辑器中所做的更改。主演示模块项目。
XAF开发成品案例参考
如果您觉得阅读本文对您有帮助,请点一下“推荐”按钮,您的“推荐”将是我最大的写作动力!欢迎各位转载,但是未经作者本人同意,转载文章之后必须在文章页面明显位置给出作者和原文连接,否则保留追究法律责任的权利。
作者博客: http://www.cnblogs.com/foreachlife
欢迎加入CIIP框架\XAF技术应用交流群: 336090194 群文件中有更多相关工具及文档资料
转载请注明出处。多谢!
欢迎加我微信: admiralcn 或扫码:
![](http://files.cnblogs.com/files/foreachlife/wx.bmp)