Skip to main content

Categorized List

  • 5 minutes to read

When data is displayed as a tree, you may need to show the objects associated with the currently selected node in the same List View. XAF enables you to do this by implementing the ICategorizedItem interface in the associated objects, and using the CategorizedListEditor provided by the TreeList Editors module. This topic demonstrates how to perform this task using the business classes defined in the Display a Tree List using the ITreeNode Interface topic.


A complete sample project is available in the DevExpress Code Examples database at

In the Display a Tree List using the ITreeNode Interface topic, the ProjectGroup, Project and ProjectArea classes are implemented by inheriting from an abstract Category class, which implements the ITreeNode interface. Now, we will implement the Issue class that will be related to the Category class by the Many-to-One relationship. In addition, to display the Issue List View via the CategorizedListEditor, the Issue class will implement the ICategorizedItem interface. For details on this interface and the CategorizedListEditor, refer to the TreeList Editors Module Overview topic.

Implement the Issue class as shown in the code below:

using DevExpress.Persistent.Base.General;
using System.ComponentModel.DataAnnotations;
public class Issue : BaseObject, ICategorizedItem {
   public virtual Category Category { get; set; }
   public virtual string Subject { get; set; }
   public virtual string Description { get; set; }

   ITreeNode ICategorizedItem.Category {
      get {
          return Category;
      set {
         Category = (Category)value;

// Make sure that you use options.UseChangeTrackingProxies() in your DbContext settings.


The public property that is returned by the private Category property, which implicitly implements the ICategorizedItem interface, must be called “Category”. This is currently required by the internal infrastructure.

Modify the Category class to add an association with Issue objects:

public abstract class Category : BaseObject, ITreeNode {
    public virtual IList<Issue> Issues { get; set; } = new ObservableCollection<Issue>();
    private List<Issue> allIssues;

    public IList<Issue> AllIssues {
        get {
            if(allIssues == null) {
                allIssues = new List<Issue>();
                CollectIssuesRecursive(this, allIssues);
            return allIssues;

    private void CollectIssuesRecursive(Category issueCategory, List<Issue> target) {
        foreach(Category childCategory in issueCategory.Children) {
            CollectIssuesRecursive(childCategory, target);

// Make sure that you use options.UseChangeTrackingProxies() in your DbContext settings.

Check that the TreeList Editors module is added to the Windows Forms application project, and run the application. Invoke the Issue List View. Select a tree node in the tree list to the left and execute the New Action, to create an Issue for the corresponding Category object. To the right of the tree list, a list of Issue objects associated with the currently selected tree node is displayed.