Search code examples
c#devexpresstreelist

DevExpress Node Images not working


I am using DevExpress TreeList. I have read this article and followed the steps.

  1. Created ImageList and added icons init.
  2. TreeList property is set SelectImageList = ImageList
  3. TreeList.ImageIndexFieldName = "ImageID"
  4. Following DataTable is assigned to TreeList.DataSource

Table is given below

ID   Name   Parent   ImageID
1    Root     0         0
2    Node1    1         1
3    node2    2         2
4    node3    2         2

The Problem is TreeList is showing same icon with each node.


Solution

  • I found the problem in this, problem was in the data type.

    While adding columns in datatable just mention its type.

    dt.Columns.Add("Parent", typeof(decimal));
    dt.Columns.Add("ImageID", typeof(decimal));