Example #1
0
        protected override void OnColumnAdded(DataGridViewColumnEventArgs e)
        {
            var column = e.Column as TreeGridColumn;

            if (column != null)
            {
                if (_expandableColumn == null)
                {
                    // identify the expanding column.
                    _expandableColumn = 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);
        }