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:
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:
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.