in
Forums
Blogs
Files
Devexpress.Com
ClientCenter
Support Center
DevExpress Channel

Gary's Blog

XAF Cookbook #2 – Change the Default Layout Position of a New Property

Problem

You inherit from an XAF business object and add the new properties your require, however you don’t like the default placement of the property elements on the UI

Solution

Use the Model Editor to change the default position of the of the UI elements.

Discussion

When you inherit from the Person class (for example) to create a Contact class, you also inherit the layout of the Person. Any new properties you add will be placed on this layout. However, the UI elements for the new property will be given the index 0, by default and so will appear at the top of the view…

ContactScreen

Now, this default positioning is seldom, if ever, what you want. Let’s assume you want the SpouseName element to sit at the bottom of the second column under the Person group. To move the position of these UI elements, you use the Model Editor.

ModelEditorBefore1

Expand the Application node, then the Contact_DetailsView node, then the Layout node, then the SimpleEditors node, then the Contact node. Under there you will find the SpouseName element. Now go back to the SimpleEditors node and open the Person node and then the Person_col2 node. Now drag the SpouseName element onto the Person_Col2 node. The SpouseName element will be placed at the bottom of the elements under the Person_Col2 node. However, you should not be fooled; when you run the application the SpouseName element will appear at the top of that column. This is because the SpouseName element has the index 0.

SpouseNameProperties

To make the element sit at the bottom of this group of elements, you must set the index (in this example) to 4.

SpouseNameProperties2

Now, when you run the application, the element will be in the desired location.

ContactScreen2

Technorati tags:
Digg This
Published Sep 02 2008, 05:10 PM by Gary Short (Developer Express)
Filed under: ,
Technorati tags: XAF, XAF Cookbook

Comments

 

CESAR F. QüEB said:

Respect to this topic i have done a suggestion:

www.devexpress.com/.../S91861.aspx

September 2, 2008 3:00 PM
 

John Watson said:

Why not take the time to show the layout designer? Seems a waste of space to go into so much detail with screen shots to describe the ordinal position of fields when it could've been done in a few sentences.

September 2, 2008 4:01 PM
 

Gary Short (Developer Express) said:

Don't worry John, I'm sure we'll get to the layout designer :-)

September 3, 2008 4:24 AM
 

Yann Duran said:

Excellent suggestion Cesar! I'm tracking it..

Yann

October 19, 2008 11:50 PM

Leave a Comment

(required)  
(optional)
(required)  
Verification code: Required
   
Add
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED