当您切换回设计器并返回时,XAML编辑器会重新格式化您的XAML. [英] XAML editor reformats your XAML when you switch to the designer and back

查看:170
本文介绍了当您切换回设计器并返回时,XAML编辑器会重新格式化您的XAML.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经与WPF合作了一段时间-我很喜欢.我很快转而使用XAML进行所有操作,因为它变得更快,更容易.我可以看到WF的情况也一样.但是VS 2010 WF xaml编辑器的功能与WPF编辑器不同,这使我发疯.

VS 2008/WPF的负责人清楚地意识到我们会大量使用XAML.而他们的编辑者则不理会您的XAML.但是2010年的WF编辑器却没有.尝试一下:切换到代码视图,并将每个名称空间放在自己的行上并保存,然后切换到设计器模式,进行更改并保存.现在切换回去.您所有的名称空间都神奇地回到了一行. rr!不只是名称空间.据我所知,设计人员已删除了我为使代码更具可读性而进行的每个布局更改.

我发现WF XAML比WPF XAML更难读,它甚至更需要大量的空白和短而易读的行,因此这种重新格式化确实困扰着我.

C#编辑器无法与我的C#*混为一谈;我看不到为什么应该允许XAML编辑器混用我的XAML.可以吗?

*好吧,所以它可以整理括号和对齐方式-我很高兴XAML编辑器可以进行对齐和< />等.但不能将文本从一行移到另一行.

我在Connect上提出了这个问题.如果您同意我的意见,请考虑提供支持.建议是: WF XAML编辑器不应重新格式化xaml .

干杯

工作流程愉快.

I've worked with WPF for a while - I love it.  I quickly switched to doing everything in XAML because it's so much quicker and easier.  I can see things going the same way for WF.  But the VS 2010 WF xaml editor doesn't work the same as the WPF editor and it's driving me nuts.

The guys responsible for VS 2008/WPF clearly realised we'd be working with XAML a lot and their editor leaves your XAML alone.  But the 2010 WF editor doesn't.  Try it: switch to the code view and put each namespace on its own line and save it, then switch to designer mode, make a change and save it.  Now switch back.  ALl of your namespaces have magically gone back onto one line.  Grrrr!  It's not just namespaces.  As far as I can tell, every layout change I've made to make the code more readable has been removed by the designer. 

I find the WF XAML much harder to read than WPF XAML and it's even more in need of lots of white space and short, readable lines so this reformatting is really bugging me.

The C# editor doesn't muck around with my C#*; I can't see why the XAML editor should be allowed to muck around with my XAML.  Can you?

*Okay, so it tidies up braces and alignment - I'm happy for the XAML editor to do alignment and < />, etc.  but not moving text from one line to another.

I've raised this as an issue on Connect.  If you agree with me, please consider lending your support.  The suggestion is: WF XAML Editor should not reformat xaml.

Cheers

And happy workflowing.

推荐答案

感谢您的反馈.

当前WF设计器将重新格式化XAML文件,但是,如果您想进行更好的格式化(例如,命名空间),则可以转到

工具->选项->文字编辑器-> XML->格式化->间距.

选择将每个属性放在单独的行上".

将所有属性(即名称空间)放在单独的行上.这帮助我查看了所有名称空间.您想直接在XAML上工作的方案?

希望有帮助,
Andrew

Thanks for the feedback.

While currently WF designer will reformat your XAML file, if you want to do some better formatting (e.g. namespaces), you can go to

Tools -> Options -> Text Editor -> XML -> Formatting -> Spacing.

Choose "Position each attribute on a separate line".

That will position all attributes (i.e. namespaces) on a separate line. That helped me to see all the namespaces.

Question: The WF Designer can do almost everything you need to do in XAML (well, there are some corner cases where you can't), for what common scenario you want to work directly on XAML?

Hope that helps,
Andrew


这篇关于当您切换回设计器并返回时,XAML编辑器会重新格式化您的XAML.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆