How to order WPF tag attributes consistently
While working with WPF I switch between XAML and the designer. This causes the attributes on each element to be ordered differently and makes the code harder to read unless I go though and reorder everything manually.
Is there an easier way开发者_高级运维 to do this?
<TextBox Name="txtFirstName" Text="{Binding Path=FirstName, Mode=Default}" Grid.Column="1" Margin="6,2,31,11" Grid.Row="5" />
<TextBox Grid.RowSpan="2" Text="{Binding Path=LastName, Mode=Default}" Margin="6,0,31,4" Name="txtLastName" Grid.Column="1" Height="25" Grid.Row="3" VerticalAlignment="Bottom" />
I use the XAML Styler extension to format my XAML files. It automatically sorts attributes by a configurable priority and does some other nice formatting for you.
Take a look at Visual Studio's Document Outline window (in View - Other Windows). It shows the document structure as a tree and allows you to quickly position into any element, so maybe it will be useful for you.
精彩评论