Assign a Standard Image 设置图标
eXpressApp Framework (XAF) includes standard images embedded into the DevExpress.Images assembly. In this lesson, you will learn how to associate a business class with a standard image. This image will represent the class in the navigation control, including detail and list form headers. For this purpose, the Department and Position classes will be used, since their ancestor (BaseObject class) is not associated with an image.
eXpressApp 框架 (XAF) 包括嵌入到 DevExpress.Images 程序集中的图标。在本课中,您将学习如何将业务类与标准图像相关联。此图像将表示导航控件中的类,包括详细信息和列表窗体标头。为此,将使用"部门和位置"类,因为它们的祖先(BaseObject 类)不与图像关联。
To see the available images, browse the following folder: %PROGRAMFILES(x86)%\DevExpress 19.2\Components\Sources\DevExpress.Images\Images.
要查看可用图像,请浏览以下文件夹%PROGRAMFILES(x86)%\DevExpress 19.2\Components\Sources\DevExpress.Images\Images.
Note 注意
Before proceeding, take a moment to review the Place an Action in a Different Location lesson.
Follow the steps below to assign images to the Department and Position classes.
在继续之前,请花点时间复习"将操作置于不同位置"课程。
按照以下步骤将图像分配给部门和职位类。
-
Invoke the Model Editor for your WinForms or ASP.NET application project.
-
Navigate to the NavigationItems node, and set ShowImages to true.
-
For WinForms applications, also set the ShowTabImage property to true in the Options node.
-
Images are now displayed for business classes. The "BO_Unknown" image is shown for classes that have no preassigned image.
- 调用 WinForms 的模型编辑器或ASP.NET应用程序项目。
- 导航到导航项节点,并将显示图像设置为 true。
- 对于 WinForms 应用程序,还将"选项"节点中的 ShowTabImage 属性设置为 true。
- 现在为业务类显示图像。对于没有预分配图像的类,将显示"BO_Unknown"图像。
-
Invoke the Model Editor. Navigate to the BOModel | MySolution.Module.Business_Classes | Department node and change the ImageName property value to "BO_Department". This is the name of the image in the %PROGRAMFILES(x86)%\DevExpress 19.2\Components\Sources\DevExpress.Images\Images folder. This folder represents a Standard Image Library.
调用模型编辑器。导航到 BOModel |MySolution.模块.Business_Classes |部门节点并将 ImageName 属性值更改为"BO_Department"。这是%PROGRAMFILES(x86)%\DevExpress 19.2\Components\Sources\DevExpress.Images\Images folder. This folder represents a Standard Image Library.
Note 注意
- When the ImageName property is focused, the ellipsis button (
) is displayed to the right of the property value. You can click this button to invoke the Image Picker dialog and browse the available images.
-
Navigate to the BOModel | MySolution.Module.Business_Classes | Position node and change the ImageName property value to "BO_Position".
-
聚焦 ImageName 属性时,省略号按钮 (EllipsisButton) 将显示在属性值的右侧。可以单击此按钮以调用"图像选取器"对话框并浏览可用图像。
-
导航到 BOModel |MySolution.模块.Business_Classes |定位节点并将 ImageName 属性值更改为"BO_Position"。
-
Run the application. You will see that Department and Position now have corresponding images displayed within the navigation bar and tab panel. If you run the ASP.NET application, you will see similar images within the page header when the Department (or Position) List View or Detail View is active.
-
运行应用程序。您将看到"部门和位置"现在在导航栏和选项卡面板中显示相应的图像。如果运行ASP.NET应用程序,当"部门(或位置)列表视图"或"详细信息视图"处于活动状态时,将在页眉中看到类似的图像。
WinForms Application
WinForms 应用程序
ASP.NET Application
ASP.NET应用程序
You can see the results in the Main Demo | MainDemo.Module project's Model Editor. 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/
您可以在主演示中看到结果 |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,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步