XamlStyler icon indicating copy to clipboard operation
XamlStyler copied to clipboard

Option to order Bindings

Open user3731 opened this issue 3 years ago • 3 comments

To improve the readability of the XAML code all our Bindings are sorted last and grouped together. After this Command Bindings are grouped together. It would be nice to also have this option in the settings.

user3731 avatar Apr 22 '21 12:04 user3731

Can you show a before and after example of what you are looking to achieve here?

grochocki avatar May 17 '21 03:05 grochocki

Before:

<cells:NoteCell DoneCommand="{Binding DoneCommand}"
                Text="{Binding Name,
                               Converter={StaticResource ExtraNameToTranslationsConverter},
                               ConverterParameter={x:Static converters:ReturnedExtraDataTypes.ExtraDescriptionTranslation},
                               Mode=OneTime}"
                IsIndented="True"
                IsVisible="{Binding IsSelected}"
                AutomationId="{x:Static testIds:DishwasherTestIds.OptionsSelection_SelectableExtrasDescription}"/>

After:

<cells:NoteCell IsIndented="True"
                Text="{Binding Name,
                               Converter={StaticResource ExtraNameToTranslationsConverter},
                               ConverterParameter={x:Static converters:ReturnedExtraDataTypes.ExtraDescriptionTranslation},
                               Mode=OneTime}"
                IsVisible="{Binding IsSelected}"
                DoneCommand="{Binding DoneCommand}"
                AutomationId="{x:Static testIds:DishwasherTestIds.OptionsSelection_SelectableExtrasDescription}"/>

The AutomationId is always ordered last. This already works perfectly. Besides that the bindings should be grouped together and stay after all the other stuff. In this example after the IsIndented='True'. Inside the bindings the command bindings should also be grouped together and sorted after the property bindings. So the 'DoneCommand' would come after the 'IsVisible' and 'Text' binding.

user3731 avatar May 17 '21 18:05 user3731

This is a must for me.

I just need all the Bindings/StaticResource (anything in "{}") at the bottom, in the same order specified for those attributes.

<Button x:Name="Button1"
        Margin="2" Content="Click Me" Height="25"
        Background="{StaticResource BlueBlah}"
        Foreground="{StaticResource WhiteBlah}"
        Visibility="{Binding ButtonVisibility"/>```

R33D3Y avatar Nov 24 '21 13:11 R33D3Y