这是一个很奇怪的问题,我希望有人知道如何解决。
情况:
找到一种改变此默认行为并使我们的弹出窗口在任何情况下都与父控件的左上角对齐的方法将是很好的。有人知道怎么做吗?
Our WPF project has a form on which we show context menus (ContextMenu control) and popups (Popup control) in response on some user actions. In most cases it happens on mouse click on some text block. Here is an example:
popup = new Popup { Placement = PlacementMode.Relative, PlacementTarget = textBlock, StaysOpen = false }; . . . . . //later on mouse click: popup.IsOpen = true;
The popup must appear aligned to the top-left corner of its placement target (some text block in our example) and so - overlap it. And it works just well in all cases except Windows 10 machines which have tablet mode (like MS Surface Pro). In such environments our popups appear to the left side of the placement targets and so - do not overlap them.
找到一种改变此默认行为并使我们的弹出窗口在任何情况下都与父控件的左上角对齐的方法将是很好的。有人知道怎么做吗?