1

I have trouble with getting my app full screen in a way that covers task bar. The code has been unchanged for years and works fine in windows 7 but now moving to windows 10 I see that on different machines the behaviour is different.

Here is what happens on some machines:

enter image description here

It is supposed to be fullsrceen from edge to edge without taskbar and instead there is a semi-transparent taskbar. If I switch to windowed mode the size is not scaled down and the taskbar is no longer transparent. Both cases some of the screen is covered by the taskbar.

Here is my code:

<controls:MetroWindow x:Class="A...MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
    xmlns:views="clr-namespace:App.Views"
    xmlns:controls1="clr-namespace:App.Controls"
    Title="App" 
    Height="768" 
    Width="1024"
    IgnoreTaskbarOnMaximize="True"  //
    WindowStyle="None"              // This should do the trick
    WindowState="Maximized"         //
    DataContext="{Binding MainWindowViewModel, Source={StaticResource ViewModelLocator}}"

I have read this and this but its not doing the trick. Is it possible that setting the size has something to do with it? I find it weird that it works fine on my dev pc, but on some other machines I get the described behaviour.

Karl Uibo
  • 353
  • 4
  • 10

2 Answers2

2

Well, if non of those work, I guess you should use Topmost="True"

And if you don't want it to bother the other applications when WindowState = Normal, you can add these events to your window:

private void Window_Activated(object sender, EventArgs e)
{
    // When window got focused
    Topmost = true;
}

private void Window_Deactivated(object sender, EventArgs e)
{
    // When window lost focus
    Topmost = false;
}
Mohamad Rashidi
  • 307
  • 2
  • 14
0
WindowStyle="None"    
WindowState="Maximized" 

This work for me

Imtee
  • 1,345
  • 13
  • 14