When Maximize a wpf page c# it overwrites the windows taskbar

Asked

Viewed 133 times

2

I am creating a project in wpf and needed to replace the buttons minimize, maximize and close, follows condition used:

if (sender == checklist.btnMaximizar)
{
    if (WindowState == WindowState.Maximized)
    {
        WindowState = WindowState.Normal;
    }
    else
    {
        WindowState = WindowState.Maximized;
    }
}
else if (sender == checklist.btnMinimizar)
{
    WindowState = WindowState.Minimized;
}
else if (sender == checklist.btnFechar)
{
    InformacaoSistema.FECHAR_CHECKLIST = false;
    Close();
}

But when I maximize the application overlaps the taskbar making it difficult to use, every example I searched the internet solved problems in windows form.

1 answer

1


Try the following:

MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
MaxWidth = SystemParameters.MaximizedPrimaryScreenWidth;

Basically we’re limiting the maximum height and width of the Form.

  • Perfect João Martins, I set up these two properties before changing the Windowstate and it worked, thank you very much for your help.

  • If the solution worked, mark the answer as correct :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.