diff --git a/src/Perspex.Controls/ContextMenu.cs b/src/Perspex.Controls/ContextMenu.cs index 861969547a..5f180b1af9 100644 --- a/src/Perspex.Controls/ContextMenu.cs +++ b/src/Perspex.Controls/ContextMenu.cs @@ -10,11 +10,7 @@ public class ContextMenu : SelectingItemsControl { private bool _isOpen; - - /// - /// The popup window used to display the active context menu. - /// - private static Popup _popup; + private Popup _popup; /// /// Initializes static members of the class. @@ -27,7 +23,7 @@ } /// - /// called when the property changes on a control. + /// Called when the property changes on a control. /// /// The event args. private static void ContextMenuChanged(PerspexPropertyChangedEventArgs e) @@ -61,8 +57,6 @@ /// public void Hide() { - - if (_popup != null && _popup.IsVisible) { _popup.Close(); @@ -77,7 +71,7 @@ /// Shows a context menu for the specified control. /// /// The control. - private static void Show(Control control) + private void Show(Control control) { if (control != null) { @@ -93,7 +87,6 @@ _popup.Closed += PopupClosed; } - ((ISetLogicalParent)_popup).SetParent(null); ((ISetLogicalParent)_popup).SetParent(control); _popup.Child = control.ContextMenu; @@ -131,7 +124,7 @@ control.ContextMenu.Hide(); } - Show(control); + contextMenu.Show(control); e.Handled = true; } else if (contextMenu._isOpen)