3

I started coding WPF applications a several months ago and now I am asking myself if there are some style guides for XAML. I do not need to get explained the benefits of Binding, Converters, Styles, Templates etc. My question is more basically.

Is there an official (or unofficial) „best practice“ about the order of attributes etc:

For instance:

<ComboBox Grid.Column="0" Grid.Row="0"
          Name="CellType"
          ItemsSource="{Binding EditorTypes}"
          SelectedItem="{Binding EditorType}">

Is there something like

  • always attached properties first [last]
  • always declare a column [row] in a Grid, even if there is only one

Are there some rules/guides I should read to make my code look more common?

1

1 Answer 1

4

There is no "official" best practice rules. There is however a Google Group that wants to establish these best practices: https://groups.google.com/group/wpf-disciples/web/wpf-and-xaml-coding-guidelines?hl=en. There even are some propositions on how to organize these files for bigger projects (company scale)

Their propositions look reasonable.

1
  • Yes, this is what I was looking for :-)
    – Markus
    Commented Aug 26, 2011 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.