none
is there a #region ... #endregion equivalent for xaml files?

    Question

  • as the subject says... some of my xaml files are getting quite big so would be great to collapse parts like we can with code with #region .. #endregion...

    thanks

    Dan

    Saturday, August 25, 2007 2:47 AM

Answers

All replies

  • AFAIK no

    Saturday, August 25, 2007 6:08 AM
  • I was just having a conversation with another WPF dev about exactly this.  We both agree that it would be a GREAT feature because XAML (well, XML) is not highly readable.  Hey Microsoft....looking for a new feature to bring joy to the hearts of your WPF developer community?

     

    Saturday, August 25, 2007 5:07 PM
  • Just adding my voice - I too would love regions in XAML code!


    (You're on a roll today Josh!)
    Saturday, August 25, 2007 6:08 PM
  •  

    pitching in as well: that would be great.

     

    as an aside: when I open a xaml file, the first thing I do is collapse everything with cntrl-M-L
    But, that's certainly not as usefull as regions ;-)

    Sunday, August 26, 2007 8:57 AM
  • Whatever kind of facility they provided would have to be compatible with XML and there are already XML editors out there that will collapse/expand XML sections.  Oxygen or Stylus will both do it.  If there were XML "section" elements it would muddy up the 1-1 correspondence between elements and objects.  Personally I think it would gum things up more than clarify them.

    Sunday, August 26, 2007 11:59 AM
  • ditto darrellp. 

     

    Additionally, wysiwyg tools like blend and cider would not know what to do with the regions when you drag elements around on the design surface (just like they currently don't know what to do with xml comments).  They would have to make assumptions that may or may not be accurate about xml elements outside of their subtree.  This is never a good idea in xml.

     

    Maybe it could be done with some sort of xml-based metadata tags, but I'm not convinced its a value add.

    Sunday, August 26, 2007 4:28 PM
  •  I add my voice too.
    love
    Friday, January 16, 2009 8:59 PM
  • This would be a very nice feature.

    Hey Doc,

    The fact that an automated tool would not know what to do with it does not mean that the feature is any less valuable.  Besides, if you are editing your XAML with a GUI tool, regions would not be needed anyway!
    Monday, April 13, 2009 7:52 PM
  • Also please add command and shortcut for collapsing all regions in XML. Something like Ctrl+M,O that we have in C# editor now.
    Monday, April 13, 2009 8:06 PM
  • its been 6 months... anything yet?  i would Love to see this feature as well.
    Monday, October 19, 2009 3:39 PM
  • I would love this feature aswell :)
    Monday, January 18, 2010 7:19 AM
  • Yet another vote for this... Raw XAML sucks, too verbose.

    Or maybe collapsing a XAML element could be more selective about what info is shown.  Right now you collapse it and the name of element remains.  If more stuff remained it would be far more useful.

    So maybe not adding a new XAML element, but a specially-formatted comment pair?
    Wednesday, January 20, 2010 10:53 PM
  • Please let me vote for this too.
    It should not be so hard to include this with the .net4 improvements

    I don't need something more fancy than this example :

    <!--#region test1-->

     

     

         <WrapPanel Visibility="{Binding PrnDiagsVisibility}" Margin="3">
         ...
         </WrapPanel>

     

     

    <!--#endregion-->

     

     

     

     


    Friday, January 22, 2010 10:16 AM
  • Please let me vote for this too.
    It should not be so hard to include this with the .net4 improvements

    I don't need something more fancy than this example :

    <!--#region test1-->

         < WrapPanel Visibility ="{ Binding PrnDiagsVisibility }" Margin ="3">
         ...
         </ WrapPanel >

    <!--#endregion-->

    I couldn't agree more with this. When collapsed, the XML comments can disappear and be shown as they are in the typical code editor: a white rectangle with a gray border with the label inside (pretty much the string of text between '#region ' and '-->'. When expanded, it can be just as shown above for easy editing... just like it is in the regular code editor.

    This solution is perfect because it's specific enough to be easily parsed and detected and thus implemented easily (the collapsing/expanding framework is obviously already there) AND it doesn't break the XML format or introduce any proprietary tags that would break readability or the reading/editing-ability in other editors.

    You, sir. I like your style.
    Tuesday, March 16, 2010 10:17 AM
  • Hi,

    This  definitely is a value add

    Hoping to see such a feature soon :)

     

    Thank You


    Please mark posts as answers/helpful if it answers your query. This would be helpful for others facing the same kind of problem
    Wednesday, March 24, 2010 7:43 AM
  • I guess this is not exactly the right forum to vote, but still... Yes, please add this.
    Thursday, June 17, 2010 8:07 AM
  • Regions in XAML would be a great feature.
    Friday, October 08, 2010 2:01 AM
  • Yes, we want it! Is there a place we can vote it up as a proposed feature or something?
    Wednesday, November 17, 2010 10:25 AM
  • Is there a place we can vote it up as a proposed feature or something?


    Microsoft Connect?

    This would be a nice feature! I was thinking of the same this past weekend.

    Wednesday, November 17, 2010 11:04 AM
  • XML regions could be implemented as a special container-control that incapsulates other elements, but has no visual character itself, and is skipped during interpretation just like XML comments. In your wysiwyg editor, it may appear as a subtle box into which you can drag elements. In XAML code, the elements are thus children of the region, while at run-time the elements appear as though they were stand-alone.

    This allows your wysiwyg editor to visually reflect the region.

    Tuesday, January 11, 2011 1:04 PM
    • Proposed as answer by Jacob Johnston Wednesday, March 02, 2011 3:12 AM
    Wednesday, March 02, 2011 1:58 AM
  • Thanks a lot !
    Wednesday, March 02, 2011 10:47 AM
  • Jacob, I LOVE your extension,

    It got me up & working *immediately*, with absolutely no fuss, when I was *struggling* to turn on a similar feature in VSCommands.


    Yann

    (plus ça change, plus c'est la même chose!)

    Monday, August 22, 2011 3:20 PM
  • Amazing thank you!
    Wednesday, September 21, 2011 7:13 PM
  • I was looking for something like this, thank u!
    Wednesday, September 21, 2011 8:05 PM
  • Just what I'm looking for. Thanks. 
    Wednesday, November 06, 2013 12:28 AM