Browse Source

Don't share Popups in ContextMenu.

Was causing render problems for some reason, and this was the quickest
way to solve it.
pull/467/head
Steven Kirk 11 years ago
parent
commit
d2d58f9fe0
  1. 15
      src/Perspex.Controls/ContextMenu.cs

15
src/Perspex.Controls/ContextMenu.cs

@ -10,11 +10,7 @@
public class ContextMenu : SelectingItemsControl
{
private bool _isOpen;
/// <summary>
/// The popup window used to display the active context menu.
/// </summary>
private static Popup _popup;
private Popup _popup;
/// <summary>
/// Initializes static members of the <see cref="ContextMenu"/> class.
@ -27,7 +23,7 @@
}
/// <summary>
/// called when the <see cref="ContextMenuProperty"/> property changes on a control.
/// Called when the <see cref="Control.ContextMenu"/> property changes on a control.
/// </summary>
/// <param name="e">The event args.</param>
private static void ContextMenuChanged(PerspexPropertyChangedEventArgs e)
@ -61,8 +57,6 @@
/// </summary>
public void Hide()
{
if (_popup != null && _popup.IsVisible)
{
_popup.Close();
@ -77,7 +71,7 @@
/// Shows a context menu for the specified control.
/// </summary>
/// <param name="control">The control.</param>
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)

Loading…
Cancel
Save