简体   繁体   中英

Changing the title of the Solution Explorer tool window in visual studio 2015

In visual studio, in the Solution Explorer you can right clock and select "New Solution Explorer from here" 在此处输入图片说明 Then a new Solution explorer tool window open - but it has the same name "Solution Explorer" - and no way to reflect the folder it represents or anything.

If I want to use multiple solution explorer windows - it'll be best if I can determine a name for them - or if their name would be representative of the root item they refer to.

Is there a visual studio extension that does that?

You can the title value via the property named caption. Here is a simple demo for your reference.

 DTE2 dte = (DTE2)this.ServiceProvider.GetService(typeof(DTE));
            List<Window> list = new List<Window>();
            foreach (Window w in dte.Windows)
            {
                if (w.Caption == "Solution Explorer")
                {
                    list.Add(w);
                }
            }

            for (int i = 0; i < list.Count; i++)
            {
                list[i].Caption = "Test" + i;
            }

在此处输入图片说明

您还可以如下所示直接获取解决方案资源管理器窗口并更新名称:

(dte.Windows.Item(EnvDTE.Constants.vsWindowKindSolutionExplorer)).Caption = "Foo"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM