I am using the following code to change the size of the screen:
private void MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
{
switch (WindowState)
{
case (WindowState.Maximized):
{
WindowState = WindowState.Normal;
break;
}
case (WindowState.Normal):
{
WindowState = WindowState.Maximized;
break;
}
}
}
}
However, when i double click as soon as the program starts, i get a small gap along the bottom of the form. To add to the confusion, when i re-size the form to any size (using drag-move), the problem is fixed. Could someone explain why this is occurring, and a possible fix to the problem?
To fully maximize your window, set
WindowStyletoNone,ResizeModetoNoResizeandWindowStatetoMaximized.[Update] The following code works fine for me (note that I have renamed your event handler since yours hides the event
System.Windows.Controls.Control.MouseDoubleClick). It resizes from Kiosk mode (fullscreen without window chrome) to regular mode without problems: