使 Visual Studio 2013 对 XAML 使用自关闭标记 [英] Make Visual Studio 2013 use Self-Closing Tags for XAML
问题描述
我刚刚开始使用 WPF,我注意到在 Visual Studio 的 XAML 编辑器中编写时,我希望将标签格式化为自闭合标签(例如 <Setter/>
) 总是自动完成以具有单独的结束标记,例如
.有没有办法改变这种行为,或者我是否坚持手动重新格式化这些标签?
I've just started messing around with WPF, and something I've noticed is that when writing in Visual Studio's XAML editor, tags that I'd like to be formatted as self-closing tags (for example <Setter />
) always get auto-completed to have a separate closing tag, like <Setter></Setter>
. Is there a way to change this behavior, or am I stuck reformatting those tags by hand?
推荐答案
我在 Visual Studio 选项中没有看到一个,但在 Resharper 选项中有一个.
I do not see one in the Visual Studio options but there is one in the Resharper options.
Resharper 菜单 -> 代码编辑 -> XAML -> 编辑器 -> 勾选在代码完成中始终创建自闭合标签"
Resharper menu -> Code Editing -> XAML -> Editor -> Check "Always create self-closed tags in code completion"
这篇关于使 Visual Studio 2013 对 XAML 使用自关闭标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!