Full screen in WPF application

C#WpfXamlFullscreen

C# Problem Overview


I am developing a WPF application which will be displayed in Full screen. In addition, the application should work on many tablets of multiple dimensions. I'd like my application to run in full screen independently from its dimensions.

What is the best practice to accomplish this task?

C# Solutions


Solution 1 - C#

Just set the WindowState to Maximized, and the WindowStyle to None.

Solution 2 - C#

Set the WindowStyle to None, and the WindowState to Maximized. This can be done like this:

WindowState = WindowState.Maximized;
WindowStyle = WindowStyle.None;

Or in xaml:

<Window x:Class="FullScreenApplication.Window"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Full Screen WPF"
    WindowState="Maximized"
    WindowStyle="None">

And simply click ALT-TAB to escape from your full screen wpf. It allows you to switch between other applications.

Solution 3 - C#

  • WindowState.Maximized
  • SizeToContent.Manual

Solution 4 - C#

fullscreen:

oldstate = WindowState;
WindowState = WindowState.Maximized;
Visibility = Visibility.Collapsed;
WindowStyle = WindowStyle.None;
ResizeMode = ResizeMode.NoResize;
Visibility = Visibility.Visible;
Activate();

going back:

WindowState = oldstate;
WindowStyle = WindowStyle.SingleBorderWindow;
ResizeMode = ResizeMode.CanResize;

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLamloumi AfifView Question on Stackoverflow
Solution 1 - C#Thomas LevesqueView Answer on Stackoverflow
Solution 2 - C#Kurt Van den BrandenView Answer on Stackoverflow
Solution 3 - C#el_yonousiView Answer on Stackoverflow
Solution 4 - C#altairView Answer on Stackoverflow