Add an Item to the Navigation Control(将项目添加到导航控件)
This lesson explains how to add the Notes item to the navigation control. When clicked, this Notes item is used to display a List View for the Note business class that you added in the previous lesson: Add an Action that Displays a Pop-Up Window.
本课介绍如何将Notes项添加到导航控件。单击时,此Notes项用于显示您在上一课中添加的Note业务类的列表视图:添加显示弹出窗口的操作。
Step-by-Step Instructions(分步说明)
1.Expand the MySolution.Module project and double-click the Model.DesignedDiffs.xafml file to invoke the Model Editor.
展开MySolutions. Module项目并双击Model.DesignedDiffs.xafml文件以调用模型编辑器。
The Model Editor pane consists of two major elements: the node tree and the context-sensitive property grid. When you select a node or focus a property, the Model Editor displays its type and a short description at the bottom of the pane.
模型编辑器窗格由两个主要元素组成:节点树和上下文相关属性网格。当您选择节点或聚焦属性时,模型编辑器会在窗格底部显示其类型和简短描述。
2.In the tree, navigate to the NavigationItems | Items | Default | Items node. The structure of the NavigationItems node and its child nodes corresponds to the structure of the navigation control. To add a child item to a navigation item, right-click the Items node and select Add… | NavigationItem in the context menu:
在树中,导航到NavigationItems|Items|Default|Items节点。NavigationItems节点及其子节点的结构对应于导航控件的结构。要将子项添加到导航项,请右键单击Items节点并在上下文菜单中选择Add…|NavigationItem:
3.Specify the following properties for the new item:
为新项目指定以下属性:
- Set the View property to Note_ListView. This property specifies the type of View the application displays when you select the Notes item in the navigation control.(将View属性设置为Note_ListView。此属性指定在导航控件中选择Notes项时应用程序显示的View类型。)
- Set the Caption property to Notes. This property specifies the name of the navigation item in the application’s UI.(将Caption属性设置为Notes。此属性指定应用程序UI中导航项的名称。)
- Set the Id property to Note. This property specifies the unique node identifier.(将Id属性设置为Note。此属性指定唯一节点标识符。)
When you change the View property value, the value of the ImageName property also changes. XAF checks the name of the View and looks for the corresponding image in the standard image library. If such image exists, XAF assigns it to the navigation item. For additional information, refer to the following lesson of this tutorial: Assign a Standard Image.
更改View属性值时,ImageName属性的值也会更改。XAF检查View的名称并在标准图片素材库中查找相应的图像。如果存在这样的图像,XAF会将其分配给导航项。有关其他信息,请参阅本教程的以下课程:分配标准图像。
4.Run the application. You can see the Notes navigation item in the navigation control. Select this item to see the List View of the Note entity class.
运行应用程序。您可以在导航控件中看到Notes导航项。选择此项以查看Note实体类的List View。
ASP.NET Core Blazor
Windows Forms