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.模块项目中。导航到导航项 |项目 |默认节点。此节点指定默认导航组的设置,该设置包含在前面的课程(联系人、任务、部门等)中创建的导航项。在右侧的网格中,将"子项显示样式"属性设置为"列表"(默认值为"大图标")。

Tutorial_UIC_Navigation_01

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 应用程序。您将看到,小图标现在用于默认导航组中的导航项。下图说明了这些更改。

Tutorial_UIC_Navigation_02

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 导航项.导航样式属性。

原文地址:https://www.cnblogs.com/foreachlife/p/Change-Style-of-Navigation-Items.html