locked
Solution explorer not displaying the correct icons. RRS feed

  • Question

  • In a C# project when a form is highlighted the View Code and View Designer icons show up at the top of the solution explorer and also in the context menu along with the View Class Diagram.  In my project system I am able to get the class view diagram to show up by enabling the VsCommands2k.ViewInClassDiagram in the QueryStatusOnNode method of the HierarchyNode class. I am also able to get the correct items depending on the file type View Form and/or View Code to show up in the context menu but the icons do not show up on the top of the solution explorer menu.  How can I get these icon on the top menu bar.

    In the QueryStatusOnNode method of my FileNode I enabling the commands VSCommands.ViewCode = 333 and VSCommands.ViewForm = 332 and they appear on the context menu but not on the top menu toolbar. 

    For the Show all files and the View in class diagram I enable the commands VSCommands2k.SHOWALLFILES and VSCommands2k.ViewInClassDiagram and they show up in both places.  Are there other commands I need for the code view and forms view?

    I have my own VSpackage for the project system.

    Mark

     

     


    Synergex
    Wednesday, October 20, 2010 2:45 PM

Answers

  • Hi Mark,

    The "View Form" and "View Designer" commands in the Solution Explorer toolbar coorespond to the guidVSStd2K::cmdidOpenInCodeView and guidVSStd2K::cmdidOpenInFormView commands, which are defined in the ShellCmdDef.vsct.

    Looking through the VSConstants.VSStd2KCmdID enum, it doesn't look like these are included in the common commands defined by the enum. But you should be able to handle these directly in your hierarchy's QueryStatus implementation.

    Specifically, you need to enable these two commands by way of your project hierarchy's IOleCommandTarget.QueryStatus implementation. If your project hierarachy is pattered after MPFProj, then you'd handle these commands in an override of QueryStatusOnNode, on the object derived from Microsoft.VisualStudio.Project.FileNode that represents that represents the soure file you want these commands enabled for.

    Sincerely,


    Ed Dore
    Monday, November 1, 2010 5:19 PM