If I set ShowInTaskbar to false, the window is still visible in the taskbar (Windows 10). Which is not what I want.
The xaml:
<Window x:Class="mycontrol.TextureProperties"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:foo"
mc:Ignorable="d"
Title="Textures Dialog"
d:DesignHeight="300" d:DesignWidth="300"
Height="300" Width="300" ResizeMode="NoResize" ShowInTaskbar="False" >
<Grid Width="300" Height="300">
<Label Content="Textures Display here" />
</Grid>
</Window>
And the code behind:
public partial class TextureProperties : Window
{
public TextureProperties()
{
InitializeComponent();
}
}
and how I'm instantiating it:
textures = new TextureProperties();
textures.WindowStartupLocation = WindowStartupLocation.Manual;
Debug.Assert(textures.ShowInTaskbar == false);
textures.Owner = this;
textures.Show();
Other:
- .NET 4.6.2
- Running on windows 10
I have tried:
- calling textures.ShowDialog(), which also does not work
- searching for similar questions here on stackoverflow. I found one which was kind of related. They wanted to show the window on the taskbar, not hide it like I want. Never-the-less I tried the answer (setting the owner property), which didn't help me.
- Just a note, that my assert that
ShowInTaskbaris false, passes. The assert does not fire at runtime. - All the different WindowsStyle options, which still doesn't help.
[Edit]
After further testing, I found that after the call to the windows Show() method, it sets ShowInTaskbar to true again. Not nice WPF!!
textures.Show();
Debug.Assert(textures.ShowInTaskbar == false);
In the code above, the assert fails at runtime. So why is that getting set behind my back?