WPF窗口隐藏(任务栏隐藏)

ShowInTaskbar="False" WindowState="Minimized" Visibility="Hidden"

一段代码就行了 加到哪看下面

<Window x:Class="Binding.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Binding"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800"
        ShowInTaskbar="False" WindowState="Minimized" Visibility="Hidden">

 又或者把Height 和 Width 改成0 例如这样 顺便在业务代码里写一个

this.Hide();
<Window x:Class="Binding.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Binding"
        mc:Ignorable="d"
        Title="MainWindow" Height="0" Width="0"
        ShowInTaskbar="False" WindowState="Minimized">

 

posted @ 2022-04-17 16:45  hack747  阅读(1309)  评论(1编辑  收藏  举报