How do I change the order of the application thumbnails displayed on the taskbar?

Let's say you have multiple apps in an app, and they are all configured to appear on the taskbar. Offsetting an application icon results in a set of thumbnails, one for each window. If there are enough windows, Windows 7 switches it to a tall, scrollable list of windows by name.

I want to re-order this list of "thumbnails" programmatically since there is a specific window that I want to be the second from the top of the list. How can i do this?

Please note that I cannot change the order in which the windows are created (this would be one of the solutions, but unfortunately I cannot use).

+3


source to share


1 answer


Well, it turns out it's pretty simple, and I was wrong.

All you have to do is set ShowInTaskbar

, for all objects Window

you want to reorder, before false

. Then put it back true

in the order you want the windows to appear. No object re-creation required Window

.

In my case, when re-ordering, the windows blinked once. It may have something to do with my current GFX driver.



NOTE. Tested and works with Windows 7 and Windows 10.

Example:

using System.Windows;

namespace WpfApp1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        Window winA = new Window();
        Window winB = new Window();
        Window winC = new Window();

        public MainWindow()
        {
            InitializeComponent();

            winA.Title = "A";    
            winB.Title = "B";
            winC.Title = "C";

            winB.Show();
            winA.Show();
            winC.Show();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            winB.ShowInTaskbar = false;
            winA.ShowInTaskbar = false;
            winC.ShowInTaskbar = false;

            winA.ShowInTaskbar = true;
            winB.ShowInTaskbar = true;
            winC.ShowInTaskbar = true;

        }
    }
}

      

+3


source







All Articles