diff --git a/src/Perspex.Controls/ContextMenu.cs b/src/Perspex.Controls/ContextMenu.cs index 0e0657b585..1b31ff92fb 100644 --- a/src/Perspex.Controls/ContextMenu.cs +++ b/src/Perspex.Controls/ContextMenu.cs @@ -11,24 +11,13 @@ { private bool _isOpen; - /// - /// Defines the ContextMenu.Menu attached property. - /// - //public static readonly AttachedProperty ContextMenuProperty = - // PerspexProperty.RegisterAttached("Menu"); - /// /// The popup window used to display the active context menu. /// private static PopupRoot s_popup; /// - /// The control that the currently visible context menu is attached to. - /// - private static Control s_current; - - /// - /// Initializes static members of the class. + /// Initializes static members of the class. /// static ContextMenu() { @@ -37,28 +26,6 @@ MenuItem.ClickEvent.AddClassHandler(x => x.OnContextMenuClick); } - /// - /// Gets the value of the ToolTip.Tip attached property. - /// - /// The control to get the property from. - /// - /// The content to be displayed in the control's tooltip. - /// - public static object GetContextMenu(Control element) - { - return element.GetValue(ContextMenuProperty); - } - - /// - /// Sets the value of the ToolTip.Tip attached property. - /// - /// The control to get the property from. - /// The content to be displayed in the control's tooltip. - public static void SetContextMenu(Control element, object value) - { - element.SetValue(ContextMenuProperty, value); - } - /// /// called when the property changes on a control. /// @@ -110,7 +77,7 @@ } /// - /// Shows a tooltip for the specified control. + /// Shows a context menu for the specified control. /// /// The control. private static void Show(Control control) @@ -121,7 +88,7 @@ { s_popup = new PopupRoot { - Content = new ToolTip(), + Content = new ContentControl(), }; ((ISetLogicalParent)s_popup).SetParent(control); @@ -130,12 +97,10 @@ var cp = MouseDevice.Instance?.GetPosition(control); var position = control.PointToScreen(cp ?? new Point(0, 0)); - ((ToolTip)s_popup.Content).Content = GetContextMenu(control); + ((ContentControl)s_popup.Content).Content = control.ContextMenu; s_popup.Position = position; s_popup.Show(); - s_current = control; - control.ContextMenu._isOpen = true; } } diff --git a/src/Perspex.Themes.Default/ContextMenu.paml b/src/Perspex.Themes.Default/ContextMenu.paml index e00ec6ddef..3a0bbcda75 100644 --- a/src/Perspex.Themes.Default/ContextMenu.paml +++ b/src/Perspex.Themes.Default/ContextMenu.paml @@ -1,5 +1,8 @@