Wpf ShowInTaskBar设置为false,窗口在任务栏中仍然可见
如果我将ShowInTaskbar设置为false,则该窗口在任务栏中仍然可见(Windows 10)。这不是我想要的 xaml:Wpf ShowInTaskBar设置为false,窗口在任务栏中仍然可见,wpf,Wpf,如果我将ShowInTaskbar设置为false,则该窗口在任务栏中仍然可见(Windows 10)。这不是我想要的 xaml: <Window x:Class="mycontrol.TextureProperties" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xa
<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>
以及我如何实例化它:
textures = new TextureProperties();
textures.WindowStartupLocation = WindowStartupLocation.Manual;
Debug.Assert(textures.ShowInTaskbar == false);
textures.Owner = this;
textures.Show();
其他:
ShowInTaskbar
是错误的,通过了。断言不会在运行时触发Show()
方法之后,它再次将ShowInTaskbar设置为true。不太好的WPF
在上面的代码中,断言在运行时失败。那为什么要在我背后设置呢?你试过#if DEBUG//…//#endif
而不是DEBUG.Assert(…)
还要检查您的调试配置-可能是因为版本1而失败:)
textures = new TextureProperties();
textures.WindowStartupLocation = WindowStartupLocation.Manual;
Debug.Assert(textures.ShowInTaskbar == false);
textures.Owner = this;
textures.Show();
textures.Show();
Debug.Assert(textures.ShowInTaskbar == false);