Jump to: navigation, search

Changes


XAML Best practices

70 bytes added, 12 June
* The x:Name is used to give a unique name for an object within a xaml file. It’s not valid in a ResourceDirectory (such as a style, template, etc, either defined within a xaml file, or in UBIKThemes), which requires using x:Key instead.
** Likewise there is a difference when referencing {{#tip-textx: Name and x:Key elements. <nowiki>x:Name | - UWP: ElementName=SubmitFormButton| Xamarin: Source={x:Reference SubmitFormButton} and {{#tip-text: x:Key | - Both: {StaticResource SubmitFormButtonStyle} elements.</nowiki>
* Use explicit language when giving a name or key, for example: “PropStkpnl” is not easily readable, but “PropertiesStackPanel” is.
* Furthermore, “FailureCodeExpression” does not describe the purpose of the expression, whereas “FailureCode_HasUnfilledFields” does.
XAML can be sometimes very weird, there are dependencies or default values that you don’t see immediately. So, a good way to prevent millions of fixes for the customer, because the environment, different device or even a different windows version destroys your UI, is to write a test plan where you test your implementation. It’s important to see exactly your controls in action on their own and acting with each other, so you can prevent doing lots of ‘easy’ fixes.
[[Category:Pages with broken file links|XAML Best practices]]
[[Category:XAML|XAML Best practices]]
423
edits