End-users can customize an XAF application user interface (UI) at runtime with ease. The Layout Manager, Column Chooser and other capabilities allow end-users to configure a UI in a "what you see is what you get" way. But when you, as a developer, customize a UI in the Model Editor, you have to deal with indexes, widths, heights, groups, etc. So, you may want to customize a UI as an end-user, and then merge changes to one of the Application Model layers in your XAF solution. This topic describes how to achieve this task using the Model Merge Tool. As an example, the column order settings will be merged from user differences into the module project layer. However, you can use the same approach to merge any end-user customizations. For example:
Mobile applications do not support Users' Model Differences, so the approach described in this topic is not supported by the Mobile platform.
In this topic we will use the MainDemo application, located in the %PUBLIC%\Documents\DevExpress Demos 18.2\Components\eXpressApp Framework\MainDemo folder. Open the MainDemo solution (C# or VB), set MainDemo.Win as the startup project and run the Windows Forms application. Select the Resume navigation item. You will see the Resume object's List View. Use drag-and-drop to swap the File column with Contact.
Close the Windows Forms application. The customizations you have made are saved to the Model.User.xafml file located in the project output folder (bin\Debug\ by default).
<ListView Id="Resume_ListView"> <Columns> <ColumnInfo Id="Contact" Index="0" /> <ColumnInfo Id="File" Index="1" /> </Columns> </ListView>
Now let us merge the end-user customizations into the Application Model of the module project. In the Solution Explorer, right click the MainDemo.Win application project and click Merge User Model. In the invoked Open dialog, choose the Model.User.xafml file.
As a result, the Model Merge Tool dialog is invoked. Navigate to the Resume_ListView node in the tree list. This node caption is displayed in bold, as the node contains customizations. Use the checkbox to the left to select this node. In the dropdown below, select MainDemo.Module and click Merge. The Resume_ListView node's differences will be merged into the MainDemo.Module project.
Finally, click Save to persist changes and close the Model Merge Tool dialog.
After merging, you can see the Resume_ListView node customizations in the Model Editor invoked for the MainDemo.Module project.
To test changes at run time, reset the user model differences. The simplest way to do this is to delete the Model.User.xafml file from your application project output folder. Then, run the Windows Forms application to see that a layout is customized as required.
As the differences were moved into a platform-agnostic module, you can see that your customizations affect the ASP.NET application as well.