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