【问题标题】:How to order WPF tag attributes consistently如何一致地对 WPF 标记属性进行排序
【发布时间】:2009-11-30 08:43:38
【问题描述】:

在使用 WPF 时,我在 XAML 和设计器之间切换。这会导致每个元素上的属性以不同的方式排序,并使代码更难阅读,除非我手动重新排序所有内容。

有更简单的方法吗?

<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" />

【问题讨论】:

    标签: .net wpf xaml code-readability


    【解决方案1】:

    我使用 XAML Styler 扩展名来格式化我的 XAML 文件。它会自动按可配置的优先级对属性进行排序,并为您进行其他一些不错的格式化。

    【讨论】:

      【解决方案2】:

      查看 Visual Studio 的 Document Outline window(在视图 - 其他窗口中)。它将文档结构显示为一棵树,并允许您快速定位到任何元素中,所以它可能对您有用。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-01-14
        相关资源
        最近更新 更多