protected override void OnMouseDown(DataGridViewCellMouseEventArgs e) { if (e.Location.X > this.InheritedStyle.Padding.Left) { base.OnMouseDown(e); } else { // Expand the node //TODO: Calculate more precise location TreeGridNode node = this.OwningNode; if (node != null) { node._grid._inExpandCollapseMouseCapture = true; if (node.IsExpanded) { node.Collapse(); } else { node.Expand(); } } } }
protected override void OnDoubleClick(EventArgs e) { base.OnDoubleClick(e); if (this.SelectedRows.Count == 1) { TreeGridNode node = (TreeGridNode)this.SelectedRows[0]; if (node.IsExpanded) { node.Collapse(); } else { node.Expand(); } } }