开发者

XAML resource naming convention

开发者 https://www.devze.com 2023-03-15 04:07 出处:网络
We are deciding if we should standardize on camelCase or PascalCase for XAML resource names. Does anybody know if one style is usually favored over the other?

We are deciding if we should standardize on camelCase or PascalCase for XAML resource names.

Does anybody know if one style is usually favored over the other?

Does Microsoft have any convention for this?

For the record, we use camelCase for fields (that includes WPF controls, in the very few cases where they are named)

To avoid religious arguments: I'm not looking for "this approach is BETTER than the other because..." responses. A goo开发者_如何学Pythond answer would include links to reference material and/or statistics.


For the x:Name attribute, you should use camel casing, as this generally results in a field being created behind the scenes. Microsoft, doesn't really follow this though in their default Styles, as control templates are one exception where a backing field is not created.

For the x:Key attribute, I've only ever seen pascal casing used. This includes in Microsoft's default Styles.

0

精彩评论

暂无评论...
验证码 换一张
取 消