4

In Visual Studio, I would like to configure the formatter such that UserControl or Window tags have their attributes on separate lines, but all other types have their attributes on the same line.

The standard formatter configuration places all the xmlns attributes into a long (and rather unwieldy) statement, which makes the code hard to read.

I've tried the formatter options, but the best I can get is to have attributes for all types on separate lines, which leads to untidy Setter blocks.

Is this possible in Visual Studio 2013?

2
  • I suppose not with built-in tools, maybe ReSharper can help, or something else,
    – Spawn
    Nov 28, 2015 at 21:19
  • I had pondered resharper in the past, but it's unlikely that the company will foot the bill, and I can't justify the cost for only code formatting. It does seem like a simple thing to carry out (Eclipse allows this level of control over automated formatting), yet VS lacks it. It's a shame, as VS is a potentially excellent tool let down by a few very annoying niggles. I shall grab a trial of resharper and see if I can find time to do a cost/benefit analysis. Thanks for the tip!
    – Alex
    Nov 28, 2015 at 21:38

1 Answer 1

3

You can use the XamlStyler plugin to format your XAML according to self-defined rules.

XamlStyler specific options.

  • Define your own attribute ordering rules
  • Define your own attribute line break rules
  • Markup extension formatting
  • Automatically reformat Xaml file on saving

enter image description here

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.