Kevin R
Kevin R

Reputation: 1014

Visual Studio 2010 sort xml/xaml attributes

In Visual Studio 2010 is there an option or does anyone know of a plugin that will allow you to sort your xml/xaml attributes alphabetically?

I would like to be able to hit a hotkey and have this:

<Button
    Grid.Row="1"
    IsEnabled="True"
    IsDefault="True"
    ContentTemplate="{DynamicResource InsertButtonContentTemplate}"
    Click="_insertButton_Click"
    Content="Insert"
    HorizontalAlignment="Right"
    VerticalAlignment="Center"
    Grid.Column="1" />

alphabetize its attributes and turn into this:

<Button
    Click="_insertButton_Click"
    Content="Insert"
    ContentTemplate="{DynamicResource InsertButtonContentTemplate}"
    Grid.Column="1"
    Grid.Row="1"
    HorizontalAlignment="Right"
    IsEnabled="True"
    IsDefault="True"
    VerticalAlignment="Center" />

Upvotes: 9

Views: 3682

Answers (2)

kyrylomyr
kyrylomyr

Reputation: 12632

You can use XAML Markup Attribute Sorter - sorts the attributes of any well formed XML such as XAML and XML files.

Upvotes: 0

Kevin R
Kevin R

Reputation: 1014

I found this Visual Studio 2010 plugin during my travels. It seems to do pretty much what I was looking for. (The plugin can be found at http://xamlstyler.codeplex.com/)

Upvotes: 3

Related Questions