protected override void OnColumnAdded(DataGridViewColumnEventArgs e)
{
if (typeof(TreeGridColumn).IsAssignableFrom(e.Column.GetType()))
{
if (_expandableColumn == null)
{
// identify the expanding column.
_expandableColumn = (TreeGridColumn)e.Column;
}
else
{
// this.Columns.Remove(e.Column);
//throw new InvalidOperationException("Only one TreeGridColumn per TreeGridView is supported.");
}
}
// Expandable Grid doesn't support sorting. This is just a limitation of the sample.
e.Column.SortMode = DataGridViewColumnSortMode.NotSortable;
base.OnColumnAdded(e);
}