XAF uses controls from the XtraEditors suite to build windows forms UI elements. Now, some of these XtraEditor controls allow XAF to format the display text using HTML. So, which of these editors can be formatted using HTML?
- Static Text Detail View Item's text.
- Property Editor's captions in Detail Views.
- Column captions of the Windows Forms GridListEditor.
By default, XAF uses this List Editor to visualize List Views in Windows Forms applications.
XAF allows these three elements to be customized via the associated attributes of the Application Model. A complete list of the HTML tags that you can use can be found here. Of course, you can switch the ability to format the display text in this way via the EnableHTMLFormatting attribute of the Application Model's Application | Options node.
Okay, so let’s have an example or two. Firstly, let’s look at the Static Text Detail View Item's text. Set the Caption attribute of the Application Model's Application | Views | Contact_DetailView | Items | WebPageAddress node to the following value:
<size=12><color=red><b>Web </b><color=0,255,0><i>Page </i><color=#0000FF><u>Address</u></color></size>
The following image shows part of the resulting Contact Detail View:
Now let’s have a look at the column's caption of the default list editor. Set the Caption attribute of the Application Model's Application | Views | Contact_ListView | Columns | LastName node to the following value:
<size=10><color=#CFCAFF><size=+4>L<color=#B0A8FF><size=+4>A<color=#6F79FF><size=+4>S<color=#4D3EFF><size=+4>T <color=#4D3EFF><size=-4>N<color=#6F79FF><size=-4>A<color=#B0A8FF><size=-4>M<color=#CFCAFF><size=-4>E</color></size>
The following image shows the resulting Contact List View:
This is yet another example of how, by leveraging other Developer Express controls, XAF makes you life as a developer easier and you more productive.