This is a much more user friendly display and will do just fine in some cases, but relying on a simple string is not that flexible.
Data Binding Overview Binding Sources Overview Data Templating Overview Binding Declarations Overview How-to Topics System.
Content Controls such as Button and Items Controls such as List Box and List View have built-in functionality to enable flexible styling of single data items or collections of data items.
The example is pretty simple, with a User class that will keep the name of the user, a List Box to show them in and some buttons to manipulate both the list and its contents.
The Items Source of the list is assigned to a quick list of a couple of users that we create in the window constructor.
As you will learn in this article, you need just a bit of extra work for this to happen, but fortunately, WPF makes this pretty easy.
There are two different scenarios that you may or may not want to handle when dealing with data source changes: Changes to the list of items and changes in the bound properties in each of the data objects.
WPF is all about templating, so specifying a data template for the List View is very easy.
In this example, we'll do a bunch of custom formatting in each item, just to show you how flexible this makes the WPF List View.
For views, you get the get a WPF notification that a viewmodel is about to go unused by a view.