From the course: Microsoft XAML: 3 Type Converters and Resources
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Data and templates in resources
From the course: Microsoft XAML: 3 Type Converters and Resources
Data and templates in resources
- [Instructor] Another comment item you'll find in your resources section, is Data. Especially when you're working with the model–view–view-model pattern. And you'll also often find data templates in there. Alternate UI that you use to render the data as it's shown in the data binding. In this example, I'll use this model class here in this trees.cs file. I have a class called Tree that has two properties, TreeName, and MaxHeight, and then I have a class up here, which is a type ObservableCollection of Tree. And you can see that I'm creating five trees and adding it to the collection. Now I'll go over to the DataWindow, and in my Resources section, I will add an instance of that tree collection. And I'll do that by bringing my namespace into scope here, and then saying Models go in Tree, and then giving it a key. So at this point, it'll instantiate that ObservableCollection. Now the next thing to do is go to my list box, and tell it to use that as the data source. So the first thing I…
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
-
-