#region in XAML

2020-02-17 12:25发布

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>

8条回答
迷人小祖宗
2楼-- · 2020-02-17 12:51

FYI: This one has been updated to work well with VS 2012 http://visualstudiogallery.msdn.microsoft.com/3c534623-bb05-417f-afc0-c9e26bf0e177

And this VS2012 extension does a nice job of beautifying the XAML so attributes automatically sort and align etc. http://xamlstyler.codeplex.com/documentation

查看更多
Bombasti
3楼-- · 2020-02-17 12:57

You can add comments to the XAML file using SSI formatting:

<!-- Grid Styles -->
<style...>
<style...>

<!-- Window Styles -->
<style...>
<style...>
<style...>

This at least gives you some sort of "header" if you use the built-in XML collapse.

查看更多
登录 后发表回答