Implicit Styles
Unlike other objects placed in a Resources collection, you can omit the x:Key and x:Name from a Style! If you do this, the target type of the Style (for example, typeof(Button)) is used as the key in the ResourceDictionary. This is handy, because it causes the Style to be implicitly applied to all elements of that target type within the same scope. This is typically called a typed style or implicit style as opposed to a named style.
The scope of a typed Style is determined by the location of the Style resource. For example, it would implicitly apply to all relevant elements in a Page if it’s added to the Page’s Resources collection or all relevant elements in the app if it’s added to Application’s Resources collection. The following ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access