Change Style of Navigation Items 更改导航项的样式
In this lesson, you will learn how to change the style of navigation items in a WinForms XAF application. By default, a 32x32 icon with a label below is displayed for each item. This style is inconvenient when you have many navigation items. To save screen space and avoid scrolling, a 16x16 icon with a label to the right can be displayed for each item instead.
在本课中,您将学习如何更改 WinForms XAF 应用程序中的导航项样式。默认情况下,每个项目都会显示一个带有以下标签的 32x32 图标。当您有许多导航项时,此样式不方便。为了节省屏幕空间并避免滚动,可以为每个项目显示右侧带有标签的 16x16 图标。
-
Invoke the Model Editor by double-clicking the Model.DesignedDiffs.xafml file located in the MySolution.Module project. Navigate to the NavigationItems | Items | Default node. This node specifies settings for the Default navigation group that encloses navigation items created in the previous lessons (Contact, Task, Department, etc.). In the grid to the right, set the ChildItemsDisplayStyle property to List (the default is LargeIcons).
-
通过双击"模型.设计Diffs.xafml"文件来调用模型编辑器。该文件位于 MySolution.模块项目中。导航到导航项 |项目 |默认节点。此节点指定默认导航组的设置,该设置包含在前面的课程(联系人、任务、部门等)中创建的导航项。在右侧的网格中,将"子项显示样式"属性设置为"列表"(默认值为"大图标")。
For details, see the IModelChoiceActionItemChildItemsDisplayStyle.ChildItemsDisplayStyle property and ItemsDisplayStyle enumeration description.
有关详细信息,请参阅 ImodelChoiceactionItems"儿童项显示样式.子项显示样式"属性和项目显示样式枚举说明。
- Run the WinForms application. You will see that small icons are now used for navigation items in the Default navigation group. The image below illustrates the changes.
- 运行 WinForms 应用程序。您将看到,小图标现在用于默认导航组中的导航项。下图说明了这些更改。
Note 注意
You can also change the style of the entire navigation control. Run the Model Editor and modify the IModelRootNavigationItems.NavigationStyle property of the NavigationItems node for this purpose.
您还可以更改整个导航控件的样式。为此,运行模型编辑器并修改导航项节点的 IModelRoot 导航项.导航样式属性。
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客户端