c# - WPF ContextMenu incorrect position -
i have been trying add context menu notify icon (system tray icon). own custom wpf wrapper around native shell_notifyicon function.
i have been using following code show context menu:
contextmenu.placement = placementmode.absolutepoint; contextmenu.horizontaloffset = args.x; contextmenu.verticaloffset = args.y; contextmenu.isopen = true;
the args.x
, args.y
absolute screen coordinates of mouse @ time notify icon clicked (i have verified contains correct mouse position).
for reason, context menu shows 5-7 pixels , left of mouse position:
the context menus of other icons on system tray display mouse is.
i searched available properties of contextmenu , nothing seemed fix it. missing something? manually adjust 7 or pixels if there better way i'd rather whatever way may be.
i'm not sure why behaves way absolutepoint. if want place context menu @ tip of mouse pointer, have tried
contextmenu.placement = placementmode.mousepoint; contextmenu.horizontaloffset = 0; contextmenu.verticaloffset = 0;
msdn (https://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.placementmode%28v=vs.110%29.aspx) explains mousepoint position context menu "...relative tip of mouse cursor , @ offset...".
Comments
Post a Comment