To manually populate a multicolumn devexpress TreeList using C# and VB.NET you can use the snippet below.
Sample C#
using System; using System.Collections.Generic; using DevExpress.XtraEditors; namespace de.Fesslersoft.MultiColumnTreeList { public partial class Form1 : XtraForm { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { var products = new List<ProductInfo> { new ProductInfo() {name = "Item1", desc = "Description1", price = Decimal.Zero}, new ProductInfo() {name = "Item2", desc = "Description2", price = 3.0m}, new ProductInfo() {name = "Item3", desc = "Description3", price = 5.45m}, new ProductInfo() {name = "Item4", desc = "Description4", price = 12.32m} }; foreach (var product in products) { var node = treeList1.AppendNode(null, null); node.SetValue(0, product.name); node.SetValue(1, product.desc); node.SetValue(2, product.price); } } } public class ProductInfo { public string name { get; set; } public string desc { get; set; } public decimal price { get; set; } } }
Sample VB.NET
Imports System.Collections.Generic Imports DevExpress.XtraEditors Namespace de.Fesslersoft.MultiColumnTreeList Public Partial Class Form1 Inherits XtraForm Public Sub New() InitializeComponent() End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Dim products = New List(Of ProductInfo)() From { _ New ProductInfo() With { _ Key .name = "Item1", _ Key .desc = "Description1", _ Key .price = [Decimal].Zero _ }, _ New ProductInfo() With { _ Key .name = "Item2", _ Key .desc = "Description2", _ Key .price = 3.0D _ }, _ New ProductInfo() With { _ Key .name = "Item3", _ Key .desc = "Description3", _ Key .price = 5.45D _ }, _ New ProductInfo() With { _ Key .name = "Item4", _ Key .desc = "Description4", _ Key .price = 12.32D _ } _ } For Each product As var In products Dim node = treeList1.AppendNode(Nothing, Nothing) node.SetValue(0, product.name) node.SetValue(1, product.desc) node.SetValue(2, product.price) Next End Sub End Class Public Class ProductInfo Public Property name() As String Get Return m_name End Get Set m_name = Value End Set End Property Private m_name As String Public Property desc() As String Get Return m_desc End Get Set m_desc = Value End Set End Property Private m_desc As String Public Property price() As Decimal Get Return m_price End Get Set m_price = Value End Set End Property Private m_price As Decimal End Class End Namespace