Skip to content
This repository was archived by the owner on Feb 20, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ public class ContextMenu : MenuBase
/// <summary>
/// Stores a reference to the current root visual.
/// </summary>
private FrameworkElement _rootVisual;
private static FrameworkElement _rootVisual;

/// <summary>
/// Stores the last known mouse position (via MouseMove).
/// </summary>
private Point _mousePosition;

public static Point MousePosition;

/// <summary>
/// Stores a reference to the object that owns the ContextMenu.
Expand Down Expand Up @@ -167,7 +168,7 @@ private void OnIsOpenChanged(bool oldValue, bool newValue)
{
if (newValue)
{
OpenPopup(_mousePosition);
OpenPopup(MousePosition);
}
else
{
Expand Down Expand Up @@ -289,9 +290,9 @@ private void HandleLayoutUpdated(object sender, EventArgs e)
/// </summary>
/// <param name="sender">Source of the event.</param>
/// <param name="e">Event arguments.</param>
private void HandleRootVisualMouseMove(object sender, MouseEventArgs e)
private static void HandleRootVisualMouseMove(object sender, MouseEventArgs e)
{
_mousePosition = e.GetPosition(null);
MousePosition = e.GetPosition(null);
}

/// <summary>
Expand All @@ -308,7 +309,7 @@ private void HandleOwnerMouseRightButtonDown(object sender, MouseButtonEventArgs
/// <summary>
/// Initialize the _rootVisual property (if possible and not already done).
/// </summary>
private void InitializeRootVisual()
private static void InitializeRootVisual()
{
if (null == _rootVisual)
{
Expand Down Expand Up @@ -480,3 +481,4 @@ private void ClosePopup()
}
}
}