Often, there will be multiple views in your form that share the same values (e.g., font size, color, etc.). There are a couple ways you can handle this:
- Create a resource dictionary and then refer to the resources using the key and the keyword StaticResource
- Declare constants and then refer to them using x:Static
While the names are very similar, x:Static and Static resources work differently. The former access a public static constant (or a public static property defined by a class). The latter, static resources, is a markup extension supported by xAML that depends on the creation of a resource dictionary.
Let’s look at how you might use both. More…