How to collapse all classes outlining in Visual Studio

Ha -- well, apparently I just needed to offer a bounty before I would discover an answer minutes later.

CtrlM, CtrlL will toggle all outlining. If anything in the file is collapsed, the first time you invoke this will expand everything and then invoking it again will collapse everything. This also collapses the namespace, which is a small inconvenience, but I'll call it progress.


The accepted answer is the roundabout way of doing it.

You're looking for Ctrl + M, A, which collapses all.

As Jay mentioned, Ctrl + M, L expands all, but collapses all if already expanded.


Actually, I found it more convenient to use CtrlM, CtrlM and specify the range:

  • To collapse everything in a file I press: CtrlA and CtrlM,CtrlM.
  • To collapse only a few sections I press: shiftPgUp/PgDn or shiftMouseClick then CtrlM,CtrlM.

This will toggle just like CtrlM,CtrlL but you decide the range!

It comes in handy to collapse multiple object initializers within a single method / everything before and after the working area. Also to expand a few relevant full-property / region / function / foreach.