public TreeGridView()
{
// Control when edit occurs because edit mode shouldn't start when expanding/collapsing
this.EditMode = DataGridViewEditMode.EditProgrammatically;
this.RowTemplate = new TreeGridNode() as DataGridViewRow;
// This sample does not support adding or deleting rows by the user.
this.AllowUserToAddRows = false;
this.AllowUserToDeleteRows = false;
this._root = new TreeGridNode(this);
this._root.IsRoot = true;
// Ensures that all rows are added unshared by listening to the CollectionChanged event.
base.Rows.CollectionChanged += delegate(object sender, System.ComponentModel.CollectionChangeEventArgs e){};
}