DotNetBar AdvTree WinForms control includes full support for data-binding through advTree.DataSource property which accepts many data objects and automatically creates columns based on advTree.DisplayMembers property setting which accepts comma separated list of field names to display.

When you set DisplayMembers property the control automatically generates the column and sets default size for them. If you want to customize columns you have two options:

1. Handle advTree.DataColumnCreated event which is fired for each ColumnHeader control internally creates. Using event arguments you can get access to the ColumnHeader created and modify it to suit your needs.

2. Clear DisplayMembers property (must be set to an empty string or null/nothing) and create your columns manually in designer or using code. In designer simply use right-click->Edit Columns command. In code create new instances of ColumnHeader object, add it to advTree.Columns collection, set its properties to set it up the way you want it, and make sure to set columnHeader.DataFieldName property with the name of the field that holds data that will be loaded into the column. Note, that this must be done before DataSource is set.

 

Related posts:

  1. How to use ItemPanel Data-Binding Features – WinForms
  2. Data-binding on popup and DataSource
  3. ComboTree Quick Start Guide
  4. AdvTree Drag & Drop Events And Options
  5. How to right-align the cell text in AdvTree control