Is it possible to get a popup to ignore MenuDropAlignment in a WPF / Touch app?

前端 未结 5 2067
终归单人心
终归单人心 2021-02-04 05:26

As a bit of background - Windows has a facility for Touch/TabletPCs whereby it shifts the position of popups/menus depending on your \"handedness\" (to prevent the menu appearin

5条回答
  •  走了就别回头了
    2021-02-04 06:06

    SystemParameters.MenuDropAlignment is used in a single method:

    System.Windows.Controls.Primitives.Popup.GetPointCombination()

    This private method has logic that depends upon the value of Popup.Placement, which is of type PlacementMode:

    public enum PlacementMode
    {
        Absolute,
        Relative,
        Bottom,
        Center,
        Right,
        AbsolutePoint,
        RelativePoint,
        Mouse,
        MousePoint,
        Left,
        Top,
        Custom
    }
    

    In GetPointCombination(), it only checks the MenuDropAlignment when the PlacementMode is Relative, AbsolutePoint, RelativePoint, or MousePoint. If you can use one of the other PlacementModes then you won't be subject to the MenuDropAlignment check.

    If you use PlacementMode.Custom, then you'll also want to set the Popup.CustomPopupPlacementCallback to a valid method in order to provide your popup's CustomPopupPlacement[] coordinates.

    Source: Reflector

提交回复
热议问题