/// <summary> /// Implement the single-click behavior for this handle, to toggle the /// expansion state of the <see cref="T:Northwoods.Go.IGoCollapsible" /> that this handle is in. /// </summary> /// <param name="evt"></param> /// <param name="view"></param> /// <returns>true if the parent <see cref="P:Northwoods.Go.IGoCollapsible.Collapsible" /> property is true</returns> /// <remarks> /// If <see cref="P:Northwoods.Go.IGoCollapsible.IsExpanded" /> is true, this calls <see cref="M:Northwoods.Go.IGoCollapsible.Collapse" />; /// otherwise this calls <see cref="M:Northwoods.Go.IGoCollapsible.Expand" />. /// If the view is non-null, this method calls <see cref="M:Northwoods.Go.GoView.StartTransaction" /> /// and <see cref="M:Northwoods.Go.GoView.FinishTransaction(System.String)" />, with a transaction name specified by /// the value of <see cref="F:Northwoods.Go.GoUndoManager.CollapsedName" /> or <see cref="F:Northwoods.Go.GoUndoManager.ExpandedName" />. /// </remarks> public override bool OnSingleClick(GoInputEventArgs evt, GoView view) { IGoCollapsible goCollapsible = FindCollapsible(); if (goCollapsible == null) { return(false); } string tname = null; try { view?.StartTransaction(); if (goCollapsible.IsExpanded) { goCollapsible.Collapse(); tname = "Collapsed"; } else { goCollapsible.Expand(); tname = "Expanded"; } } finally { view?.FinishTransaction(tname); } return(true); }