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

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