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

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

  • Saturday, August 25, 2007 2:47 AM
     
     
    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

All Replies

  • Saturday, August 25, 2007 6:08 AM
    Moderator
     
     Answered

    AFAIK no

  • Saturday, August 25, 2007 5:07 PM
     
     
    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 6:08 PM
     
     
    Just adding my voice - I too would love regions in XAML code!


    (You're on a roll today Josh!)
  • Sunday, August 26, 2007 8:57 AM
     
     

     

    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 11:59 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 4:28 PM
     
     

    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.

  • Friday, January 16, 2009 8:59 PM
     
     
     I add my voice too.
    love
  • Monday, April 13, 2009 7:52 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 8:06 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, October 19, 2009 3:39 PM
     
     
    its been 6 months... anything yet?  i would Love to see this feature as well.
  • Monday, January 18, 2010 7:19 AM
     
     
    I would love this feature aswell :)
  • Wednesday, January 20, 2010 10:53 PM
     
     
    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?
  • 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-->

     

     

     

     


  • Tuesday, March 16, 2010 10:17 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.
  • Wednesday, March 24, 2010 7:43 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
  • Thursday, June 17, 2010 8:07 AM
     
     
    I guess this is not exactly the right forum to vote, but still... Yes, please add this.
  • Friday, October 08, 2010 2:01 AM
     
     
    Regions in XAML would be a great feature.
  • Wednesday, November 17, 2010 10:25 AM
     
     
    Yes, we want it! Is there a place we can vote it up as a proposed feature or something?
  • Wednesday, November 17, 2010 11:04 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.

  • Tuesday, January 11, 2011 1:04 PM
     
     

    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.

  • Wednesday, March 02, 2011 1:58 AM
     
     Proposed
    • Proposed As Answer by Jacob Johnston Wednesday, March 02, 2011 3:12 AM
    •  
  • Wednesday, March 02, 2011 10:47 AM
     
     
    Thanks a lot !
  • Monday, August 22, 2011 3:20 PM
     
     

    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!)

  • Wednesday, September 21, 2011 7:13 PM
     
     
    Amazing thank you!
  • Wednesday, September 21, 2011 8:05 PM
     
     
    I was looking for something like this, thank u!