Sep 20, 2010 at 7:08 PM
Edited Sep 20, 2010 at 9:10 PM
I have been playing with it and found a solution for my specific case, but I cannot say that it is a proper solution for all the scenarios supported by the control.
In the function
mousePos, Point? offset,
I replaced the calculation for RootGrid.Margin to the following:
Rect rect = ActualTriggerElement.GetBoundsRelativeTo(Application.Current.RootVisual).Value;
Thickness(OffsetX + rect.Left + (offset.HasValue
? offset.Value.X : 0), OffsetY + rect.Top + (offset.HasValue ? offset.Value.Y : 0), 0, 0);
The original code was:
RootGrid.Margin = new Thickness(mousePos.X
+ OffsetX + (offset.HasValue ? offset.Value.X : 0),mousePos.Y
+ OffsetY + (offset.HasValue ? offset.Value.Y : 0),
is still a problem with this solution when the menu is configured to pop up when the mouse hovers. The problem is that the menu disappears soon after you move the mouse onto the popped up area, probably because there is code elsewhere that now thinks
the mouse is not over the menu and so dismisses it. I am still trying to diagnose that one.