I need to change windows taskbar in my WPF application. For that I set WindowStyle=\"None\", which means to disable the windows taskbar, and make custom taskbar
Proposed solution worked for me but still need to correct pixel to dpi setter values for window to have correct size regardless user settings:
in xaml :
WindowStyle="None" WindowState="Maximized" ResizeMode="NoResize"
in code :
public MainWindow()
{
InitializeComponent();
var graphics = System.Drawing.Graphics.FromHwnd(IntPtr.Zero);
var pixelWidth = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width ;
var pixelHeight = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;
var pixelToDPI = 96.0 / graphics.DpiX ;
this.Width = pixelWidth * pixelToDPI;
this.Height = pixelHeight * pixelToDPI;
this.Left = 0;
this.Top = 0;
this.WindowState = WindowState.Normal;
}