I am wanting to hide a WPF window that has WindowStyle="None"
, AllowTransparency="True"
and ShowInTaskbar="False"
from the task menu (Alt+Tab).
I have already researched this but all the results appear to be for WinForms or don't have an answer. Here are some of the sources I have already looked into:
- Same question on VS community WITHOUT an answer
- Same question on StackOverflow but for WinForms
- Same question but for WinForms on generic site
- This doesn't meet my requirements because I still want the WPF window to be visible, just not seen in the Alt+Tab menu
Here is my XAML code:
<Window x:Class="DesktopInfo.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:DesktopInfo"
mc:Ignorable="d"
Title="MainWindow" SizeToContent="WidthAndHeight" WindowStyle="None" AllowsTransparency="True" Background="Transparent" ShowInTaskbar="False" Loaded="FormLoaded">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Testing" Name="UsernameTextBlock" FontSize="20" FontWeight="Bold" Foreground="White"/>
<TextBlock Name="ComputernameTextBlock" Grid.Row="1" FontSize="20" FontWeight="Bold" Foreground="White"/>
</Grid>
</Window>
Here is my C# code:
using System;
using System.Windows;
using System.Windows.Forms;
namespace DesktopInfo
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
///
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
No matter what I try, I cannot get the WPF form to not show up in the Alt+Tab menu. Any help is very much appreciated :)
UPDATE AFTER DUPLICATE FLAG After looking at the link that was provided (and previously viewed before asking this question), I would like to state that I, in fact, found the answer here and will post my full code as an answer to this question :)