XAF – Model Merge Tool (coming in v2011 vol1)

End-users can customize an XAF application user interface 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.

With the v2011 vol 1 release, we have introduced a new XAF design time functionality - Model Merge Tool.


This instrument is intended to merge Application Model customizations into an underlying model layer. It means that now you can customize a View items layout at run time, and then move down these changes into the module project layer. Of course, the layout is not the only customization that can be merged - you can merge any differences that can be applied to a target model layer. The most evident use cases are merging Detail View and Dashboard layouts, grid customizations (columns order, visibility, grouping, etc), chart and pivot grid settings.

Let us take a closer look on how to use the Model Merge feature with the MainDemo application. Assume that we have customized the Resume List View at run time (for instance, changed columns order):


The customizations we have made are automatically saved to the Model.User.xafml file located in the project output folder:

<ListView Id="Resume_ListView">
    <ColumnInfo Id="Contact" Index="0" />
    <ColumnInfo Id="File" Index="1" />

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 that, you can see the Resume_ListView node customizations in the Model Editor invoked for the MainDemo.Module project.



As the differences were moved into a platform-agnostic module, they affect the ASP.NET application as well:




In the Model Merge Tool, you can select several nodes at once, and repeat the merging operation as many times as required, before clicking Save. If a part of the selected differences cannot be applied to the selected target, a warning message will be displayed. In this instance, you can try another target (e.g. MainDemo.Module.Win).

If your application is already deployed, and one of end-users has a carefully crafted layout, you may want to use this layout in a new version of the application. In this instance, just copy the Model.User.xafml file from the end-user workstation, and select this file in the Open dialog when running the Model Merge Tool.

If you want to merge differences from an application or module project into an underlying module, select the Merge Model item instead of Merge User Model in a project’s context menu. The Model Merge Tool will be invoked for the current project in this instance.

The following video illustrates the Model Merge Tool in use:

What do you think about this addition to the framework? Please let us know!

UPDATE: We have posted a new Merge User Differences from a Custom Model Storage blog that describes how to merge a user model stored in a database.

11 comment(s)

Hey - at last. Good work!

20 April, 2011

Seems promising!!! Can't wait to try!!!

20 April, 2011
Nate Laff

It's beautiful! However, it won't work for me :( I store user models in the DB, rather than file system. Doh!

20 April, 2011
John Zhang

current I store user models in the DB as well. so is it possible to use this mergy model? if not. is it possible implement a solution that allow some user not store user models in the DB, and some user store user models in the DB

20 April, 2011
Nate Laff


I've toyed with that posibility. I have an Administrator user (that can't be deleted) that I've thought about storing in the file system.

The other problem I need to tackle is if the Administrator makes a change (lets say, adds a variant or filter to a listview) I want those changes to propogate to all user diffs in the DB. I'm planning on just overriding what they have with the updated model (including skin, etc...) but this tool certainly lays the ground work for selective merging.

20 April, 2011
Alberto Cortes


20 April, 2011
Kobus Smit

Great! This is an useful enhancement that will save us time. One more step making XAF more RAD.

20 April, 2011
James Zhong

Very nice new feature! It allows developers and requirement analysts as well as end users to collaborate on UI layouts.

21 April, 2011
Fırat Esmer

Very useful, thanks guys!

21 April, 2011

Nate, I think you are okay as long as you can export your model changes to disk. You will need to do this for both the project and user models; then you can merge them and ship them back to the database.

21 April, 2011
Dennis (DevExpress Support)

@All: We have posted a new blog that describes how to merge a user model stored in a database: community.devexpress.com/.../xaf-merge-user-differences-from-a-custom-model-storage.aspx

22 April, 2011

Please login or register to post comments.