I want my wpf application to be able to switch to full screen on my primary and secondary screens
currently it doesn't work
even though i moved the wpf window to my secondary screen it will only go full screen on the primary
private void MaximizeButton_Click(object sender, RoutedEventArgs e)
{
if (WindowState == WindowState.Normal)
{
// Berücksichtigen der Taskleiste und speichern der vorherigen Fenstergröße und Position
previousHeight = Height;
previousWidth = Width;
previousTop = Top;
previousLeft = Left;
var workingArea = SystemParameters.WorkArea;
MaxHeight = workingArea.Height;
MaxWidth = workingArea.Width;
Top = workingArea.Top;
Left = workingArea.Left;
WindowState = WindowState.Maximized;
}
else
{
// Wiederherstellen der vorherigen Fenstergröße und Position
MaxHeight = double.PositiveInfinity;
MaxWidth = double.PositiveInfinity;
Height = previousHeight;
Width = previousWidth;
Top = previousTop;
Left = previousLeft;
WindowState = WindowState.Normal;
}
}