Sometimes, the C# source code editor feels a bit sluggish, even on pretty fast systems. One way to speed it up a little is by turning off the navigation bar (the drop down lists above the code window).
- “Tools” menu -> “Options”
- “Text Editor” -> “C#”
- Uncheck “Navigation bar” under “Display”
Of course, the navigation bar is there for a reason and some people just can not live without it. But if you’re like me, and don’t use all the time, you may find the following macro for toggling the navigation bar helpful:
Dim objShowNavigationBar As EnvDTE.Property
objShowNavigationBar = DTE.Properties("TextEditor", "CSharp").Item("ShowNavigationBar")
objShowNavigationBar.Value = Not objShowNavigationBar.Value
- Open the Macros IDE (“Tools” -> “Macros” -> “Macros IDE”)
- Either create a new module or use an existing one (e.g. I have a module “Misc” where I collect all my small macros) and paste the code into it.
You could assign the macro to a hotkey (Tools -> Options -> Keyboard), but even though I use hotkeys a lot, for this macro I prefer an icon in a toolbar near the navigation bar:
- Right click the toolbar area -> “Customize”
- The “Customize” dialog opens
- On the “Toolbars” tab: Create a new toolbar (e.g. "My Macros")
- Drag the (floating) toolbar to the toolbar area and move it somewhere near the navigation bar.
- On the “Commands” tab: Click the category "Macros"
- Choose the macro (e.g. "MyMacros.Misc.ToggleCSharpNavigationBar") from the “Commands” list and drag it to the toolbar
The toolbar will look something like this:
- Copy the following image to the clipboard
- Back in Visual Studio, right click the macro name -> “Paste Button Image”
- Right click the macro name -> “Default Style”
- Right click the macro name -> “Name” -> Enter "Toggle Navigation Bar"
- Close the “Customize” dialog
The button on the toolbar is now ready to use and will look like this: