Provide Several View Variants for End-Users 为最终用户提供多个视图变体
In this lesson, you will learn how to provide several customized variants of the same View, and allow an end-user to choose a desired View variant at runtime. Variants can be applied to both List Views and Detail Views. In this lesson, the Contact List View will be used. Two variants of this List View will be constructed via the Module Editor. To switch between these View variants, the special ChangeVariant Action will be used. To add this Action, the ViewVariants module will be referenced in the application.
在本课中,您将学习如何提供同一视图的多个自定义变体,并允许最终用户在运行时选择所需的视图变体。变体可以同时应用于"列表视图"和"详细信息视图"。在本课中,将使用联系人列表视图。此列表视图的两个变体将通过模块编辑器构造。要在这些视图变体之间切换,将使用特殊的更改变量操作。要添加此操作,将在应用程序中引用"查看变体"模块。
Note 注意
Before proceeding, take a moment to review the following lessons.
在继续之前,请花点时间复习以下课程。
- Inherit from the Business Class Library Class (XPO/EF)
- 从商务舱库类 (XPO/EF) 继承
- Change Field Layout and Visibility in a List View
- 在列表视图中更改字段布局和可见性
- Add the View Variants module to your MySolution.Module project. Find the Module.cs (Module.vb) file in the MySolution.Module project displayed in the Solution Explorer, and double-click this file. The Module Designer will be invoked.
In the Toolbox, navigate to the DX.19.2: XAF Modules tab. Drag the ViewVariantsModule item from this tab to the Designer's Required Modules section.
将"查看变体"模块添加到 MySolution.模块项目中。在解决方案资源管理器中显示的 MySolution.module 项目中查找Module.cs (Module.vb) 文件,然后双击此文件。将调用模块设计器。
在工具箱中,导航到 DX.19.2:XAF 模块选项卡。将"视图Variants模块"项目从此选项卡拖动到"设计器的必需模块"部分。

- Rebuild your solution so that the changes made in the Module Designer are loaded to the Application Model.
Invoke the Model Editor for the MySolution.Module project. Right-click the Views node and select Add... | ListView.
重新生成解决方案,以便将模块设计器中所做的更改加载到应用程序模型。
调用 MySolution.模块项目的模型编辑器。右键单击"查看"节点并选择"添加..." |Listview。

For the new node, set the Id property to "Contact_ListView_AllColumns" and the ModelClass property to "Contact".
对于新节点,将 Id 属性设置为"Contact_ListView_AllColumns",将 ModelClass 属性设置为"联系人"。

- Right-click the newly created node and select Generate content. Columns will be generated using information on the specified class (BOModel | Contact node) and its ancestors. Leave these columns as is. This List View will represent the complete variant for the Contact List View.
- 右键单击新创建的节点并选择"生成内容"。将使用指定类上的信息生成列(BOModel |联系节点)及其祖先。保持这些列不变。此列表视图将表示联系人列表视图的完整变体。

Right-click the Views node and select Add... | ListView. For the new node, set the Id property to "Contact_ListView_Varied" and the ModelClass property to "Contact". Do not generate content for the new node.
右键单击"查看"节点并选择"添加..." |Listview。对于新节点,将 Id 属性设置为"Contact_ListView_Varied",将 ModelClass 属性设置为"联系人"。不要为新节点生成内容。

Expand the newly added Contact_ListView_Varied node, right-click the Variants child node and select Add... | Variant.
展开新添加的Contact_ListView_Varied节点,右键单击变体子节点并选择"添加..." |变异。

For the new node, set the View property to "Contact_ListView", and set the Id and Caption properties to "Few columns".
对于新节点,将 View 属性设置为"Contact_ListView",并将 Id 和标题属性设置为"很少列"。

Right-click the Variants node and select Add... | Variant. For the new node, set the View property to "Contact_ListView_AllColumns", and set the Id and Caption properties to "All columns".
右键单击变体节点并选择"添加..." |变异。对于新节点,将 View 属性设置为"Contact_ListView_AllColumns",并将 Id 和标题属性设置为"所有列"。

Navigate to the NavigationItems | Items | Default | Items | Contact node. Its View property, specifying the View displayed when choosing the Contact navigation item, is "Contact_ListView" by default. Change it to "Contact_ListView_Varied".
导航到导航项 |项目 |默认值 |项目 |联系节点。默认情况下,其 View 属性(指定选择"联系人"导航项时显示的视图)为"Contact_ListView"。将其更改为"Contact_ListView_Varied"。。

Run the WinForms or ASP.NET application. Select the Contact item in the navigation control. For the displayed Contact List View, the ChangeVariant Action will be activated. This Action's items represent the view variants specified in the Model Editor.
运行 WinForms 或ASP.NET应用程序。选择导航控件中的"联系人"项。对于显示的联系人列表视图,将激活"更改变量"操作。此操作的项表示模型编辑器中指定的视图变体。

Note 注意
You can use the Index property to specify the sort order of variants in the ChangeVariant Action drop-down list. Additionally, you can set the Current property of the Variants node to specify the default variant.
可以使用 Index 属性在"更改变体操作"下拉列表中指定变体的排序顺序。此外,还可以设置变体节点的"当前"属性以指定默认变体。
Optionally, you can add view variants to the navigation control. For this purpose, invoke the Model Editor and set the GenerateRelatedViewVariantsGroup property of the NavigationItems node to true.
或者,您可以将视图变体添加到导航控件。为此,调用模型编辑器,并将导航项节点的"生成相关视图VariantsGroup"属性设置为 true。

Note 注意
Ensure that the IModelChoiceActionItemChildItemsDisplayStyle.ChildItemsDisplayStyle property of the current navigation group node is set to List (see Change Style of Navigation Items). Otherwise, the view variants will not be added to the navigation control in the WinForms application.
确保 IModelChoiceActionItemItem 显示样式.子项显示当前导航组节点的样式属性设置为"列表"(请参阅更改导航项的样式)。否则,视图变体将不会添加到 WinForms 应用程序中的导航控件中。
As a result, the Contact navigation item will expose child items for each view variant.
因此,"联系人"导航项将公开每个视图变体的子项。

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. 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/
您可以在本课中为模型调用的模型编辑器中所做的更改。主演示模块项目。主演示应用程序安装在%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/
.
Provide Several View Variants for End-Users 为最终用户提供多个视图变体的更多相关文章
- shader 变体variants
https://blogs.unity3d.com/cn/2018/05/14/stripping-scriptable-shader-variants/ variants涉及的是build时间和da ...
- pure::variants — 产品线变体管理工具
pure::variants 是德国 pure-systems 公司的产品,其目的是帮助企业实现对产品线的变体管理,提高企业项目资产的复用效率.pure::variants 的核心理念是运用产品线管理 ...
- JavaWeb网上商城的反思
不知道从什么时候起,我爱上了写博客,对之前学得的只是进行反思.写了几天课程设计,代码量量8.9千左右. 然后下面文字是我在博客上复制过来的,说得很详细 MVC(Model View Controlle ...
- Table View Programming Guide for iOS---(一)---About Table Views in iOS Apps
About Table Views in iOS Apps Table views are versatile user interface objects frequently found in i ...
- Make a List View Editable 使列表视图可编辑
In this lesson, you will learn how to make a List View editable. For this purpose, the DemoTask List ...
- Change Field Layout and Visibility in a List View 在列表视图中更改字段布局和可见性
This lesson will guide you through the steps needed to select columns displayed in the List View. Fo ...
- Meet User Expectations---满足用户的期待
Back to App Design Meet User Expectations OS X incorporates the latest technologies for creating gre ...
- XAF导航系统介绍
Navigation System 导航系统 10 min to read 阅读时长10分钟 This topic introduces the concept of the navigation s ...
- 设计模式-Java版-全-附代码-超生动实例
阅读推荐:设计模式-简单篇 项目地址:https://gitee.com/zwtgit/gof23 学习网站推荐: https://refactoringguru.cn/design-patterns ...
随机推荐
- 【开发者portal在线开发插件系列二】多条上下行消息(messageId的使用)【华为云技术分享】
前言和基本操作请参考[开发者portal在线开发插件系列一]profile和基本上下行消息,此处不再复述,没操作过的小伙伴一定要先去看看哦~ 话不多说,开始今天的演(表)示(演) 场景说明: 假设一: ...
- Java修炼——递归算法的俩个实例
1.是输出指定文件目录下的所以子目录以及文件 2.使用递归算算法:1!+2!+3!+4!+5!+-+n!(计算阶乘累加) package com.bjsxt.recurison; import jav ...
- 当用python读取几十万行文本时,会出现什么状况?
前言本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理.作者:accumulate_zhang 我在使用python读取几十 ...
- C# Pkcs8 1024位 加密 解密 签名 解签
部分代码来至 https://www.cnblogs.com/dj258/p/6049786.html using System; using System.Collections.Generic; ...
- 基于iCamera测试模拟摄像头-TVP5150模块小结
基于iCamera测试模拟摄像头-TVP5150模块小结 首先先认识下模拟摄像头,相信大家都不陌生, CCD模拟摄像头 CMOS模拟摄像头 可以看到,ccd摄像头电路较复杂,接口少,而cmos摄像头, ...
- iSensor APP 之 摄像头调试 OV3640 OV2640 MT9d112 ov5642
iSensor APP 之 摄像头调试 OV3640 OV2640 MT9d112 iSensor app 非常适合调试各种摄像头,已测试通过的sensor有: l OV7670.OV7725.O ...
- 从零开始的openGL——四、纹理贴图与n次B样条曲线
前言 在上篇文章中,介绍了如何加载绘制模型以及鼠标交互的实现,并且遗留了个问题,就是没有模型表面没有纹理,看起来很丑.这篇文章将介绍如何贴纹理,以及曲线的绘制. 纹理贴图 纹理加载 既然是贴图,那首先 ...
- 简单了解一下K8S,并搭建自己的集群
距离上次更新已经有一个月了,主要是最近工作上的变动有点频繁,现在才暂时稳定下来.这篇博客的本意是带大家从零开始搭建K8S集群的.但是我后面一想,如果是我看了这篇文章,会收获什么?就是跟着步骤一步一走吗 ...
- Java_零碎知识回顾
封装的理解 1.隐藏实现细节,控制对象的访问权限:对外提供公共方法: 隐藏:private 本类可见 继承的理解 ①父类有共性的属性与方法:子类只需要继承,扩展自己独有的属性方法即可,实现了代码的可复 ...
- 【MySql】使用学习
[MySql]使用学习 =================================================== 1.太多的连接 Too many connections ======= ...