Control styles provide a way to build consistent UI across your application controls. This video looks at defining styles and using them within a XAML file.
- [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 apply it to this last TextBlock,…
Released
10/27/2016- Creating custom type converters
- Creating custom markup extensions
- Adding parameters
- Using resources
- Working with styles, colors, data, and templates in resources
- Creating resources
- Locating resource files
- Loading resource files
Share this video
Embed this video
Video: Styles in resources