XamlStyler
XamlStyler copied to clipboard
FormatMarkupExtension always rewrite my bindings on a single line
Describe the bug
When setting "FormatMarkupExtension": false in my configuration file, XAML Styler still puts my "Binding" attributes on a single line.
To Reproduce Steps to reproduce the behavior:
- Create a WPF project with a XAML file.
- Make sure the "FormatMarkupExtension" option of XAML Styler is set to false.
- Add this in the XAML:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<DataTemplate x:Key="DataTemplate1">
<TextBlock Text="{Binding Path=Name,
UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</ResourceDictionary>
- Format the file (by saving it, for instance).
- See that the binding is on a single line:
<TextBlock Text="{Binding Path=Name, UpdateSourceTrigger=PropertyChanged}" />
Expected behavior When setting this setting to false, I expect that XAML Styler let me write my bindings on several lines.
External Configuration See the attached configuration file (I had to add a ".json" extension to add it to this issue): Settings.XamlStyler.json
Version Info (please complete the following information):
- OS: Windows 10 Version 22H2 Build 19045.4894
- Visual Studio: Professional 17.12.0 Preview 1
- XAML Styler: 3.2404.2
Could we have something that allows comma-separated values to go into newlines? This could come in handy with the Avalonia UI framework as well, specifically with style selectors:
<Style Selector="ContentControl Button,
ContentControl StackPanel,
...">
<Setter Property="IsVisible" Value="True" />
<Setter Property="Opacity" Value="1" />
</Style>
When setting this setting to false, I expect that XAML Styler let me write my bindings on several lines.
@Smallgiil Can you try the following configuration to see if it achieves the formatting you are looking for?
@grochocki It does not seem to change much. With the example described in the issue, I still have the same behavior.
There is no logic for this. Markup extensions are either outputted as single line or multiple line ( when not in NoNewLineMarkupExtensions ).
Docs should be updated to reflect this https://github.com/Xavalon/XamlStyler/wiki/Markup-Extension-Handling