We're going to aggregate three controls together.
We've already built the user maintenance control, so we'll build on top of that.
This control is going to contain the toolbar and it's
going to contain two other user controls.
We're going to build a user list control and a user detail
control with corresponding view models as well.
Let's create the user control to list users.
Right-mouse-click on the UserControls folder and let's Add User Control
and give it a name of UserMaintenanceListControl.
Go ahead and add that.
Once it's built,
we're going to remove the grid portion that it builds
automatically and replace it with a ListView.
So this ListView, if we take a look at this,
has its ItemsSource set to the Path of Users.
So that means we're going to have to create a Users collection
in the view model that goes along with this.
And we'll talk about that in a minute.
Inside of the ListView.View,
I've added a GridView and a GridViewColumn with a Header of Edit.
This is going to be a GridViewColumn.CellTemplate that has a DataTemplate.
The DataTemplate is going to be made up of a Button and the button has
a certain style to it and a Tag that is Binding.
So when you say binding, that means we're binding to a user object,
because we have a Users collection of User objects.
We added a ToolTip and we added an Image within the button,
so we can click on it, but we also have an image that displays,
in this case, an Edit_Black.png,
which comes from our Images folder in the WPF.Common.
We then have a few other GridViewColumns here, as you can see.
One we're going to bind up the UserId, the UserName,
the FirstName, the LastName, and the EmailAddress.
These are all columns that come from our user table.
The last column we have is another GridViewColumn that has a CellTemplate.
The DataTemplate is exactly like the other one,
it's a Button that contains an Image.
In this case though, the image is Trash_Black.png.