views:

190

answers:

2
+5  Q: 

#region in XAML

I actually don't like #region in my code. BUT for some reason call me crazy, I would like to have them in my XAML. I would like whole sections to have a #region-like thing and collapse them (e.g. my <Window.CommandBindings>, <Grid.*Definitions>, <Menu>, <Toolbar>, etc..

Does this exist? If not, how about <RegionCollapse>

+3  A: 

No, but according to this reply by Microsoft:

This is a great suggestion. Thanks very much. We will consider it for a future release

Justin Ethier
+5  A: 

I might be missing the point of your request, but the XAML editor automatically puts collapsible regions around the elements. Note the nodes in the left rail of the editor window. Click the "-" and the associated element collapses to a single line, much like a #region.

Hans Passant
+1, and you can put XML comments in with the XAML to "header" the sections.
sixlettervariables
I know about that, but when I open the file, I need actively do it I'm looking for it to be automatic on file open.
kenny
Yeah, no problem. Edit + Outlining + Toggle. It will restore the state when you load the project again, making it "automatic".
Hans Passant
I'll try it thanks!
kenny