The toolkit comes with a project template, a sample application, and two white papers. The first paper provides a brief description of the MVVM pattern. The second paper provides step-by-step instructions for developing the sample application yourself. While I would not consider the application to be "complete," it does provide an excellent initial look at how to use the template and how to implement the MVVM pattern in a WPF application.
First, let's look at the template. Suppose, you want to develop an application called MyWpfApp. From Visual Studio, you would select from the menu: FileNewProject. This action, of course, brings up the New Project dialog. In the dialog, select, in the left pane, project type Visual C#Windows. Then, in the right pane, select the WPF Model-View Application template. Finally, in the first textbox of the lower portion of the dialog, name your project MyWpfApp:

After you click the OK button, you are asked, in another dialog, whether or not you want to create a test project:

After you click OK, a solution with a WPF/MVVM project (hereafter called the main project) and a test project is set up for you:

Notice that the only files in the main project folder itself are app.xaml and its code-behind file app.xaml.cs. Sub-folders are defined which, except for one, correspond to the different application "layers" associated with the MVVM pattern: Models, Views, and ViewModels. A folder that you might not have expected is the Commands folder. The Views, ViewModels, and Commands folders are populated with an initial set of files which may be used in developing your application. We will examine the contents and purpose of these files in the next post.
Previous posts in this series:

No comments:
Post a Comment