Window out of the screen when maximized using WPF shell integration library

前端 未结 7 439
无人及你
无人及你 2020-12-01 01:30

I\'m using the WPF Shell Integration Library to create a custom chrome of my wpf app. All is good, but when maximizing the app, 6 or 7 pixels are out of the screen.

7条回答
  •  有刺的猬
    2020-12-01 01:48

    In my project, I have CaptionHeight set to 0 and ResizeMode set to CanResizeWithGrip. This is the code I came up with for the proper thickness.

                Thickness maximizeFix = new Thickness(SystemParameters.WindowNonClientFrameThickness.Left +
                    SystemParameters.WindowResizeBorderThickness.Left,
                    SystemParameters.WindowNonClientFrameThickness.Top +
                    SystemParameters.WindowResizeBorderThickness.Top
                    - SystemParameters.CaptionHeight,
                    SystemParameters.WindowNonClientFrameThickness.Right +
                    SystemParameters.WindowResizeBorderThickness.Right,
                    SystemParameters.WindowNonClientFrameThickness.Bottom +
                    SystemParameters.WindowResizeBorderThickness.Bottom);
    

    I'm just going to use a border like Joe Castro did and then bind the thickness to a property that I update when the window state changes.

    Code seems janky but I haven't found another solution yet.

提交回复
热议问题