├── LICENSE └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Christopher MANEU 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | XAML Coding guidelines 2 | ====================== 3 | 4 | ## How to contribute 5 | 6 | You can open an issue on this project to raise an issue/argument about an existing rule, or to submit a new rule. For each submission, please at least produce the following items: 7 | 8 | - Cause 9 | - Rule description 10 | - Justification 11 | - How to fix violation 12 | 13 | You can also add a code sample of the violation and a code sample with the violation fixed. 14 | 15 | ### Want to translate the XAML coding guidelines in another language ? 16 | 17 | Sure! Please create an issue and we can discuss how we can work on creating multilingual versions of these guidelines. 18 | 19 | ## Guideline principles 20 | 21 | - **Be easy to follow**: Each rule must be explained as simply as possible. Any developer on his/her 1st day with Xaml must be able to follow these rules, 22 | - **Be as uncontroversial as possible**: These rules must be out of debate. We're not here to determine if it's better to have a white-themed Visual Studio or a black-themed one (Pro-Tip: the correct answer is of course black). So, each rule must have a justification. An inspiration from [StyleCop](http://www.stylecop.com/docs/StyleCop%20Rules.html) rules can be useful, 23 | - **Be usable for any Xaml-based project**: Windows Phone, WPF or Universal apps. It must apply for all of them. If a rule only applies to one platform, it should go under a platform-specific section. 24 | 25 | 26 | ## Rules 27 | 28 | ### XA1x. Code readability 29 | 30 | #### XA1001 - Put one attribute per line 31 | ##### **Cause** 32 | Multiple attributes are declared on the same line. 33 | 34 | ##### **Rule description** 35 | A violation of this rule occurs whenever an element has multiple attributes declared on the same line. For example: 36 | 37 | ```xml 38 | 189 | ``` 190 | 191 | ##### **Rule description** 192 | A violation of this rule occurs when an element does not declare child tags and uses an explicit closing tag. 193 | This leads to too much space waste. 194 | 195 | Visual Studio and Blend XAML code editors can easily expand closing tags if needed when adding the first child of an element, therefore that argument is not pertinent. 196 | 197 | ##### **How to fix violation** 198 | Use a self-closing element instead. 199 | 200 | ```xml 201 |