Windows Store Apps - Data Binding in Depth

Learn how to create data-driven Windows Store Apps by using Data Bindings, Data Templates, and WinRT's Data Controls.
Course info
Rating
(100)
Level
Intermediate
Updated
Jul 23, 2014
Duration
4h 33m
Table of contents
Description
Course info
Rating
(100)
Level
Intermediate
Updated
Jul 23, 2014
Duration
4h 33m
Description

Every App displays some kind of data. When developing Windows Store Apps, you can use WinRT's Data Binding to bind the User Interface of your App to that data. With Data Bindings, there's no need to create Event Handlers to synchronize the data between different Controls in your UI, instead the Data Binding will do that job for you. The Data Binding-infrastructure of XAML-based frameworks is the base for the famous Model-View-ViewModel pattern (MVVM). This course teaches you how to use Data Bindings with all the tips and tricks you need to know. You'll learn how to create Data Bindings in XAML and C#, how to debug Data Bindings, how to use different data sources for a Data Binding like Dependency Properties, .NET Properties, Resources, relative Sources, and Collections. Beside that, you'll learn how to render your data-objects with DataTemplates, how to use the WinRT-Data Controls like ListView and GridView, and how to create Design-Time data. Throughout this course you'll see many demonstrations that demonstrate best practices, like grouping with CollectionViews, using a Semantic Zoom, implementing an Incremental Loading of data, using a ViewModelLocator, creating Design-Time-Data in Blend, and many more.

About the author
About the author

Thomas is a well-known author, software developer, and speaker from Germany. He specializes in .NET, C#, TypeScript, XAML, and Azure.

More from the author
.NET Standard: Getting Started
Intermediate
2h 44m
May 14, 2018
More courses by Thomas Claudius Huber
Section Introduction Transcripts
Section Introduction Transcripts

Data Sources for a Binding
Welcome to the module Data Sources for a Binding. My name is Thomas Claudius Huber, and in this module you will learn about different sources for a data binding. We will look at Dependency properties, classical. NET properties, Resources, RelativeSources, and at value conversion with an IvalueConverter. For your project, it's important how to bind to the different sources, and it's even more important to know what the different sources need to fulfill. So, for example, if you want to bind to a classical. NET property, that property needs to notify about its changes, else the binding wouldn't be able to update its target. To make the. NET property notify about its changes, the class needs to implement the interface INotifyPropertyChanged. So, for example, for classical. NET properties, you will learn in this module how to implement INotifyPropertyChanged, so let's start.

Binding to Collections
Welcome to the module Binding to Collections. My name is Thomas Claudius Huber, and in this module I will show you all the details you need to know when you have a Collection as source for your data binding. In the previous module, you already learned about different sources for a data binding, and I showed you that properties need to notify about their changes. The same is true for collections. Collections need to notify the data binding when an item has been added or removed so that the data binding can update the Target. This notification is also done by an interface that's called INotifyCollectionChanged. In this module, you will learn about this interface and also about other interfaces for change notification of Collections that are available when developing Windows Store applications. Besides those change notification interfaces, we will also look at CollectionViews. When you bind to a Collection, you often want to know what is the current item and how can you move to the next or to the previous item. The CollectionView has exactly this logic, it is a kind of wrapper around a Collection and it extends it with the CurrentItem property, with methods to move to the next or previous item, and it also allows grouping of a Collection. So in this module, you also learn how to create and use CollectionViews in XAML and C#. Okay, so let's start with the change notification interfaces.

Data Rendering
Welcome to the module, Data Rendering. My name is Thomas Claudius Huber, and in this module we will look at the possibilities you have to display your data objects in the UI. By default, data objects are displayed with the result of their two string methods. In this module, you will learn different possibilities like setting the DisplayMemberPath property on an ItemsControl or like defining a DataTemplate to define a UI for your data object. You will also learn how you can do some kind of conditional formatting by using a DataTemplateSelector that can select the specific DataTemplate based on the data of your data object. So let's start and first look at how the data rendering is done by default.

WinRT's Data Controls
Welcome to the module WinRT's Data Controls. My name is Thomas Claudius Huber, and in this module we look at the different data controls available for Windows Store apps. Those are the FlipView, the ListView, and the CreateView. Besides the specific characteristics and how to use these controls, you also learn how to display group data. To do all this, you will get in touch again with data templates and also with the CollectionViewSource class. After the grouping of data, we will also look at how to do a semantic zoom of your data. With a semantic zoom, a user is able to zoom out of your data to get a high-level view, and from this high- level view you can navigate back into the details. In the last step of this module, I will show you how to do an incremental loading of your data. That is quite useful if you load a large set of items from a server and you don't want to load the whole collection at once. Then you can do an incremental loading. That means each time the user scrolls down, for example in a ListView, more data is reloaded from the server. Okay, so let's start by looking at the class hierarchy of the data controls in the Windows Runtime.

Design-Time Data
Welcome to the module, Design-Time Data. My name is Thomas Claudius Huber, and in this module you will learn how you can provide Design-Time Data for the visual designers in Visual Studio and Blend. Throughout this course, we have created data bindings and data templates by writing XAML code, but it's also possible to create data bindings and data templates in the visual designers of Visual Studio and Blend. But to do this, some Design-Time Data needs to be available, and in this module you'll learn how to provide Design-Time Data. First I will show you which objects are created at Design-Time, and then you will learn how you can check in your codes if the process is running in DesignMode or not. Afterwards, we'll look at different ways to provide Design-Time Data. You will learn how to use the Design DataContext, how to use a ViewModelLocator, how to use the designer-specific markup extensions DesignInstance and DesignData, and you will also see how to create DataTemplates in Blend by using the visual designer of Blend. So let's start with a DesignMode check in code.