Maximize WPF Window on the current screen

后端 未结 10 685
谎友^
谎友^ 2021-01-31 07:35

I have a windowless wpf application, whenever I set the window state as maximized it maximizes it on the primary display.

What I would like to do is have it maximize on

10条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-31 08:21

    Because of the taskbar you should use user working area's size:

    this.Width=SystemParameters.WorkArea.Width;
    this.Height=SystemParameters.WorkArea.Height;
    

    You can use this in view's constructor

提交回复
热议问题