From the course: XAML Fundamentals: Building Powerful UIs for Cross-Platform Applications
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Data sources in resources - XAML Tutorial
From the course: XAML Fundamentals: Building Powerful UIs for Cross-Platform Applications
Data sources in resources
- Another common item you can add to the resource section is your data models especially when you're working with the model view, view model pattern. This M V V M pattern is very popular in ZL frameworks. It is a topic worth exploring more. The way that works is you have a view model and then in your resources section you would instantiate your view model. In this example I'm just using a simple class A models class. I'm not using a view model class and you can find that here in this models folder in this trees.cfa. So there's two classes defined in here. The tree class is where we keep the data. It has a tree name and a max height and then I have a trees class which is a type observable collection of tree. We like observable collection in W P F because it's observable meaning if the data and the collection changes the UI will update to reflect that. Here you can see in the constructor of this class I am setting…
Contents
-
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
XAML resources and ResourceDictionaries3m 40s
-
(Locked)
The resources property1m 43s
-
(Locked)
Use resources with the StaticResource markup extension3m 13s
-
(Locked)
Styles in resources2m 57s
-
(Locked)
Colors in resources2m 6s
-
(Locked)
Data sources in resources2m 25s
-
(Locked)
Data templates in resources3m 7s
-
(Locked)
Explore the resource hierarchy3m 16s
-
(Locked)
A quick look at merged resources7m 38s
-
(Locked)
Load a resource file for dynamic application UI3m 58s
-
(Locked)
Explore the Properties window2m 30s
-
(Locked)
Create resources with the Properties window4m 38s
-
(Locked)
-