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…
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.
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.
To make the element sit at the bottom of this group of elements, you must set the index (in this example) to 4.
Now, when you run the application, the element will be in the desired location.
Technorati tags:
XAF Cookbook