From the course: Microsoft XAML: 3 Type Converters and Resources
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Styles in resources
From the course: Microsoft XAML: 3 Type Converters and Resources
Styles in resources
- [Narrator] Now we'll look at how to use some common items you find in Resource sections. And I'll start with styles. Styles are we have determining and setting a number of common properties that you want to apply to lots of elements. In this example, I've decided that I have a style that I want to apply to some of my TextBlocks. So, in my Windows Resource section, I create a style. I'm instantiating the style and then I have to create a key, because it's in a Resource Dictionary. So I do that, it's called "BigAndBold." And then I have to specify what the target type is, so it knows which one to apply it to. In this case, it's a TextBlock. And then I have these setters. There's a setter for setting the text size to 24, and the font-weight bold. Now I can come down here to this TextBlock, this second TextBlock here, and set the style to a static resource, named "BigAndBold." Then all of the setter values in that style are applied to this TextBlock. And if I take the same style, and…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Types of resources6m 31s
-
XAML resources and ResourceDictionaries4m 4s
-
The Resources property2m 44s
-
Use resource with the StaticResource markup extensions3m 46s
-
Styles in resources1m 23s
-
Colors in resources1m 29s
-
Data and templates in resources3m 3s
-
Explore the resource hierarchy2m 51s
-
Create Resources with the Properties window5m 54s
-
A quick look at merged resources5m 24s
-
Use the Pack URI to locate resource files2m 39s
-
Load a resource file for dynamic application UI2m 6s
-
-