Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've found a solution, but it's not pretty. So far this is the <em>only</em> thing I've tried that actually works:</p> <pre><code>Window w = new Window(); // Create helper window w.Top = -100; // Location of new window is outside of visible part of screen w.Left = -100; w.Width = 1; // size of window is enough small to avoid its appearance at the beginning w.Height = 1; w.WindowStyle = WindowStyle.ToolWindow; // Set window style as ToolWindow to avoid its icon in AltTab w.Show(); // We need to show window before set is as owner to our main window this.Owner = w; // Okey, this will result to disappear icon for main window. w.Hide(); // Hide helper window just in case </code></pre> <p>Found it <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/8e3a788e-1e14-4751-a756-2d68358f898b/" rel="nofollow noreferrer">here</a>.</p> <p>A more general, reusable solution would be nice. I suppose you could create a single window 'w' and reuse it for all windows in your app that need to be hidden from the <kbd>Alt</kbd>+<kbd>↹Tab</kbd>.</p> <p><strong>Update:</strong> Ok so what I did was move the above code, minus the <code>this.Owner = w</code> bit (and moving <code>w.Hide()</code> immediately after <code>w.Show()</code>, which works fine) into my application's constructor, creating a public static <code>Window</code> called <code>OwnerWindow</code>. Whenever I want a window to exhibit this behavior, I simply set <code>this.Owner = App.OwnerWindow</code>. Works great, and only involves creating one extra (and invisible) window. You can even set <code>this.Owner = null</code> if you want the window to reappear in the <kbd>Alt</kbd>+<kbd>↹Tab</kbd> dialog.</p> <p>Thanks to Ivan Onuchin over on MSDN forums for the solution.</p> <p><strong>Update 2:</strong> You should also set <code>ShowInTaskBar=false</code> on <code>w</code> to prevent it from flashing briefly in the taskbar when shown.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload