WPF : Maximize window with WindowState Problem (application will hide windows taskbar)

前端 未结 6 1556
执笔经年
执笔经年 2020-12-30 01:30

I have set my main window state to \"Maximized\" but the problem is my application will fill the whole screen even task bar. what am i doing wrong ? I\'m using windows 2008

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-30 02:21

    I wanted the opposite (with WindowStyle=None), but reversing this solution also works for your case:

    // prevent it from overlapping the taskbar
    
    // "minimize" it
    WindowStyle = WindowStyle.SingleBorderWindow;
    // Maximize it again. This time it will respect the taskbar.
    WindowStyle = WindowStyle.None;
    WindowState = WindowState.Maximized;
    // app is now borderless fullscreen, showing the taskbar again
    

    What I did for my case:

    // make it always overlap the taskbar
    
    // From windowed to maximized without border and window bar
    WindowStyle = WindowStyle.None;
    WindowState = WindowState.Maximized;
    // Now the window does not overlap the taskbar
    Hide();
    Show();
    // Now it does (because it's re-opened)
    

提交回复
热议问题