Blogs

Gary's Blog

XAF – Styling ASP.Net Applications #1

     

Cast your mind back to just before TecheEd US and you’ll remember that Oliver wrote a series of posts entitled “10 Exciting Things to Know About XAF”. The ninth posting was on styling ASP.Net applications. In that post Oliver mentioned that our story around styling wasn’t as we wanted it to be and there would be improvements in the future. Well, with version 8.3 that future is here.

Currently an XAF ASP.Net application is built using a number of templates, these templates define which ActionControllers are to be displayed and in which order, along with how the Controls on the View are to be arranged. There are two ways to influence the look and feel of an XAF ASP.net application, the first is to alter the theme of the supplied templates, and the second is to change these templates to suit your own needs. In this post we will examine both of these approaches.

XAF v2008 vol 3 ships with a single built-in theme. However, more themes will be supplied in future releases. You can also create themes based on the Developer Express ASP.NET controls' existing themes.

The themes for an XAF ASP.Net solution are located in the YourSolution.Web\App_Themes folder. Each subfolder contains a theme, which bares the same name as the subfolder. The current theme is specified by the pages.theme setting in the Web.config file and, by default, is set to the XafDefault theme:

<system.web>
  <pages theme = "XafDefault" />
  ...
</system.web>

You can change this setting's value to any theme in the App_Themes folder.

The second means of styling your ASP.Net application is to change the templates upon which the application is built. XAF uses five Templates in the UI construction:

  1. Default.aspx - defines the main window.
  2. Dialog.aspx - defines a popup window.
  3. Error.aspx - defines an error window.
  4. Login.aspx - defines a logon window.
  5. NestedFrameControl.ascx - defines a nested frame (e.g. used to display a nested List View in a Detail View).

XAF v2008 vol 38.3 ships with two main window Templates - Default.aspx and DefaultVertical.aspx. The Default.aspx template, is the default template used to define the main window. In this template, the navigation tabs are aligned horizontally:

However, if you prefer your navigation tabs to be aligned vertically, then you can use the DefaultVertical.aspx template:

So, how do you swap the vertical template for the horizontal one? Actually its very simple and is achieved via renaming. Simply rename Default.aspx (to say DefaultHorizontal.aspx) then rename DefaultVertical.aspx to Default.aspx and you’re done!

Digg This
Published Dec 02 2008, 11:29 AM by Gary Short (DevExpress)
Filed under:
Technorati tags: XAF
Bookmark and Share

Comments

 

Gary's Blog said:

In part 1 of this two part post we looked at how to change the theme of the templates that make up an

December 2, 2008 7:05 AM
 

Alberto Cortes said:

Great! Excelent!

December 2, 2008 7:12 AM
 

Mohsen Benkhellat said:

I like the vertical navigation however, it would more useful if a user can hide it anytime (like in Windows version) or at least have a splitter to reorganize the surface real estate as needed.

Mohsen

December 2, 2008 10:10 AM
 

Binish Peter said:

I think there should be another template which is similar to menus in www.devexpress.com

December 2, 2008 1:38 PM
 

Tim Shnaider said:

Gary, excellent posts, really highlights that anything is possible if you want to spend a bit of time customising templates.  You've given us the tools, now we need to put in some effort.

Having just seen the Siverlight line of business post though I'm reconsidering my platforms! (I'll do this 2-3 times a day of course) ;)

December 2, 2008 3:04 PM
 

ui | Digg hot tags said:

Pingback from  ui | Digg hot tags

December 3, 2008 3:28 AM
 

Garth Henderson said:

+1 on Mohsen's recommendation to have an option to Hide the Vertical Nav bar.

The vertical template is great for medium and large projects.

December 8, 2008 1:57 PM
More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 8:30am and 5:00pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.