Blogs

Gary's Blog

XAF - Dog-Fooding with Conditional Appearance

     

As many of you might already know, we are successfully using XAF for many our internal applications. For example, our bug and support issues tracking applications (DXSupport, having both Win and Web parts) and applications for maintaining sales (MyDX). In this blog post I would like to show you how we utilize the Conditional Appearance module in the DXSupport application.

Imagine an Issue business object, representing a base object for various kinds of support issues (e.g. bug reports, questions, suggestions, etc.). It has a HoursActive property, which of course, indicates how many hours an issue has been active. Now this is a very important property when it comes to the internal workflow of the application. We will have several Appearance rules based on this property, which are intended to attract the attention of the DXSupport user to the issue, according to the predefined internal workflow rules. Since DXSupport users cannot recompile the application, the Appearance rules will be defined in the Application Model through the Model Editor:

Appearance Rules

And here is the corresponding XAFML code:

<BOModel>
  <Class Name="DevExpress.MyDX.Issue">
    <AppearanceRules>
      <AppearanceRule Id="IssueListViewActive_0-4" IsNewNode="True" FontColor="0, 192, 0" 
Criteria="Status.Name == 'Active' AND HoursActive" < #4:00#" TargetItems="*" Context="ListView" AppearanceItemType="ViewItem" Index="0" /> <AppearanceRule Id="IssueListViewActive_4-18" IsNewNode="True" FontColor="MediumTurquoise"
Criteria="Status.Name == 'Active' AND (HoursActive > #4:00# AND HoursActive" < #18:00# )" TargetItems="*" Context="ListView" AppearanceItemType="ViewItem" Index="1" /> <AppearanceRule Id="IssueListViewActive_18-24" IsNewNode="True" FontColor="MediumBlue"
Criteria="Status.Name == 'Active' AND (HoursActive > #18:00# AND HoursActive" < #23:59#)" TargetItems="*" Context="ListView" AppearanceItemType="ViewItem" Index="2" /> <AppearanceRule Id="IssueListViewActive_24+" IsNewNode="True" FontColor="192, 0, 0"
Criteria="Status.Name == 'Active' AND HoursActive > #23:59#"
TargetItems="ArticleId;HoursActive;Status;AssignTo" Context="ListView" AppearanceItemType="ViewItem"
FontStyle="Bold" Index="3" /> <AppearanceRule Id="IssueListViewActive_NotAccepted" IsNewNode="True" Index="4" Criteria="!Accepted"
TargetItems="*" Context="ListView" AppearanceItemType="ViewItem" FontStyle="Bold" /> </AppearanceRules> </Class> </BOModel>

The settings will be saved in the Model.User.XAFML file in the application folder. Then we can easily redistribute these changes amongst DXSupport users. In turn, other users can modify these rules as required, for instance, change the colours to ones that better suite their purposes.

Here is one of the screens from the application:

DXSupport screen

We would love to hear how you incorporated Conditional Appearance into your projects, so if you want to share with us, please tell us about it in the comments.

That’s all for this post, so ‘til next time, happy XAF’ing.

Published Nov 30 2010, 01:40 AM by Gary Short (DevExpress)
Filed under: ,
Technorati tags: v2010.2, XAF
Bookmark and Share

Comments

 

Nate Laff said:

I have 118 Conditional Appearance rules in my project. Mainly used for hiding editors when not applicable. I would say 80% of them are used for that, the rest are disabling BO's/editors when they're locked down (after an object has been saved for example, I don't want them editing it.)

This module (and CES before it) are invaluable to my project. My life would be much harder without it! Easily my favorite module in XAF!

November 29, 2010 9:05 PM
 

Robert Fuchs said:

@Nate: +1

In addition I use it a lot for enabling/disabling actions, this is very important for my app.

November 30, 2010 10:30 AM
 

Robert Fuchs said:

@Gary: These settings will be saved in the Model.User.XAFML???

AFAIK not.

November 30, 2010 10:32 AM
 

Dennis (DevExpress Support) said:

We are glad to hear from you, Guys!

>>

These settings will be saved in the Model.User.XAFML???

<<

Yes, we will put these settings into the Model.User.XAFML file. However, it is also possible to put them into the Model.XAFML file of our application.

November 30, 2010 11:31 AM
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.