/// <summary> /// Collapses this widget if not already collapsed. /// </summary> protected virtual void Close() { if (IsExpanded) { // Use keyboard or mouse depending on config. if (configuration.ControlWithKeyboardInsteadOfMouse) { ContainerElement.SendKeys(Keys.Escape); } else { ContainerElement.Click(); } WaitForAnimationEnd(); } }