エンドユーザーの変異体は、エンドユーザーへの複数のビューを提供するためのいくつかの表示バリアントを提供

このレッスンでは、同じのいくつかのカスタマイズされた変種を提供する方法を学びますビューを、エンドユーザが所望の選択を可能にするビューの実行時にバリアントを。変異体は、両方に適用することができリストビュー詳細ビューこのレッスンでは、連絡先リストビューが使用されます。この二つの変種リストビューを経由して構築されるモジュール・エディタこれらを切り替えるにはビューバリアント、特別ChangeVariantアクションが使用されます。このアクションを追加するには、ViewVariantsのモジュールは、アプリケーションで参照されます。

このレッスンでは、より多くのカスタムは、同じビューの変異体、およびエンドユーザーが実行時に目的のビューバリアントを選択することができますどのように提供するかよりも学びます。変異体は、「リストビュー」と同時に適用することができる「詳細表示。」このレッスンでは、連絡先リストビューを使用します。二つは、モジュールの構成エディタを使用してリストビューの変異体。これらのビューを切り替えるには、特別な変数の変更操作を使用して、変異体です。この操作は、アプリケーションの「表示バリアント」モジュールへの参照を追加します。

ノートノート
先に進む前に、以下のレッスンを検討する時間を取ります。
先に進む前に、次のコースを確認するために時間を割いてください。
  • ビジネスクラスライブラリクラスから継承されますXPO / EF)
  • クラスライブラリから(XPO / EF)ビジネスクラスの継承
  • リストビューで変更するには、フィールドレイアウトと可視性
  • リストビュー内のフィールドレイアウトと可視性を変更します

 

  • 追加ビューバリアントあなたにモジュールをMySolution.Moduleのプロジェクト。検索Module.csModule.vbで)ファイルMySolution.Moduleのプロジェクトを内に表示ソリューションエクスプローラ、このファイルをダブルクリックします。モジュールデザイナーが呼び出されます。

、ツールボックスにナビゲートDX。19.2:XAFモジュール ]タブをクリックします。ドラッグViewVariantsModuleのデザイナーさんにこのタブからアイテムを必須モジュールのセクション。

  • MySolution。モジュールプロジェクトに「ビューバリアント」モジュールを追加します。MySolution.module項目はModule.cs(Module.vb)ファイルを見つけるソリューションエクスプローラに表示し、ファイルをダブルクリックします。呼び出しモジュールデザイナー。

 ツールボックスで、DX.19.2に移動しますXAFモジュール]タブ。「ビューバリアントモジュールは、」このタブと「デザイナーに必要なモジュール」セクションにドラッグし、それを投影します。

Tutorial_EM_Lesson2_0

  • 行われた変更するように、あなたのソリューションを再構築モジュールデザイナーがにロードされているアプリケーションモデル
  • 呼び出しモデルエディタMySolution.Moduleのプロジェクト。右クリックし、[ ビュー]ノードを選択し...追加 | リストビュー

  • 変更は、アプリケーションモデルにロードされたモジュール設計者にソリューションを再構築します。

  • コールMySolution。モデルエディターモジュールプロジェクト。「ビュー」ノードを右クリックし、「追加...」を選択|リストビュー。

Tutorial_EM_Lesson2_0_1

 新しいノードの場合、設定のId「Contact_ListView_AllColumns」とにプロパティをModelClassの「連絡先」へのプロパティ。

对于新节点,将 Id 属性设置为"Contact_ListView_AllColumns",将 ModelClass 属性设置为"联系人"。

Tutorial_EM_Lesson2_0_2

 

  • 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 |联系节点)及其祖先。保持这些列不变。此列表视图将表示联系人列表视图的完整变体。

Tutorial_EM_Lesson2_1

 

  • 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 属性设置为"联系人"。不要为新节点生成内容。

    Tutorial_EM_Lesson2_2_1

Expand the newly added Contact_ListView_Varied node, right-click the Variants child node and select Add... | Variant.

展开新添加的Contact_ListView_Varied节点,右键单击变体子节点并选择"添加..." |变异。

Tutorial_EM_Lesson2_2_2

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 和标题属性设置为"很少列"。

Tutorial_EM_Lesson2_2_3

  • 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 和标题属性设置为"所有列"。

    Tutorial_EM_Lesson2_2_4

  • 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"。。

    Tutorial_EM_Lesson2_2_5

  • 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应用程序。选择导航控件中的"联系人"项。对于显示的联系人列表视图,将激活"更改变量"操作。此操作的项表示模型编辑器中指定的视图变体。

    Tutorial_EM_Lesson2_3

    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。

    Tutorial_EM_Lesson2_5

    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.

因此,"联系人"导航项将公开每个视图变体的子项。

Tutorial_EM_Lesson2_6

 

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/

あなたはこのレッスンで行われた呼び出しをモデル化することができるモデルエディタを変更します。メインのデモモジュールプロジェクト。デモアプリケーションをメインにインストールされているドキュメント\ DevExpress社のデモ\%PUBLIC%を19.2 \コンポーネント\ eXpressApp Frameworkの\ MainDemoは、デフォルトでは。ASP.NETバージョンでのオンライン利用はAT IS http://demos.devexpress.com/XAF/MainDemo/

 

おすすめ

転載: www.cnblogs.com/foreachlife/p/Provide-Several-View-Variants-for-End-Users.html