// Need to override Clone for design-time support. public override object Clone() { HierarchicalGridColumn c = (HierarchicalGridColumn)base.Clone(); c._defaultNodeImage = this._defaultNodeImage; return(c); }
protected override void OnColumnAdded(DataGridViewColumnEventArgs e) { if (typeof(HierarchicalGridColumn).IsAssignableFrom(e.Column.GetType())) { if (_expandableColumn == null) { // identify the expanding column. _expandableColumn = (HierarchicalGridColumn)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); }