Jump to: navigation, search

Changes


XAML Best practices

1,107 bytes added, 24 June
/* Implicit and Explicit Styling */
=== Implicit and Explicit Styling ===
The following code snippet makes use of several features of XAML Styling:
[[File:Performance_ImplicitStyling.JPG]]
 
* You can use very localized ResourceDictionaries to avoid repeatedly customizing similar controls. In this example, all Labels within the StackPanel inherit the defined style.
* By not assigning an x:Key to the style, it will be used as the default style for all controls of the Label type within that StackPanel unless a Style assigned to them. This is called '''Implicit Styling'''.
* On the other hand, Labels with a Style attribute will ignore any inherited Implicit styling.
* The Implicit style will be assigned first, and will be overwritten by any defined attributes, like TextColor in this example.
* The localized Style definitions in this StackPanel will be passed down to all controls contained within it, no matter how deep the nesting goes.
* The BasedOn attribute can be used to create a sub-style based on another existing style. However, the TargetType must always match.
 
[[Category:Pages with broken file links|XAML Best practices]]
[[Category:XAML|XAML Best practices]]
=== Content Templating ===
511
edits