XamlStyler icon indicating copy to clipboard operation
XamlStyler copied to clipboard

Only WPF Setter elements are considered for reordering

Open tvass83 opened this issue 2 years ago • 1 comments

The "Reorder setters" feature only considers Setter elements that reside in the following xml namespace definition: https://github.com/Xavalon/XamlStyler/blob/82b68c5007959a67f3c38f869c1c5a38375214a7/src/XamlStyler/DocumentManipulation/DocumentManipulationService.cs#L87

As other elements (like Style) are not restricted in such way, it would be great to make use of this feature for other xaml frameworks, like AvaloniaUI.

I'm well aware of #300, but this seems to be an unnecessary restriction on Setters.

To Reproduce Create a new AvaloniaUI project and try to format the following code with the "Reorder setters" feature set to Property:

<Style Selector="Button">
      <Setter Property="Margin" Value="1" />
      <Setter Property="Background" Value="Gray" />
</Style>

Note: AvaloniaUI now seems to work well with the standard .xaml extension in VS2019 (no need for .axaml), so this is not an issue with file extensions.

tvass83 avatar Sep 15 '21 11:09 tvass83

FormatThicknessService also hardcodes this xml namespace, thus preventing correct formatting of all the configured Thickness attributes: https://github.com/Xavalon/XamlStyler/blob/master/src/XamlStyler/DocumentManipulation/FormatThicknessService.cs#L12-L13

tvass83 avatar Oct 25 '21 11:10 tvass83