Building a Data-Driven Master/Detail Business Form in WPF using Visual Studio 2010

Version: 1.1.0

Description

In this lab you will learn all the necessary steps for creating and customizing a master-detail business form in WPF 4 using Visual Studio 2010 tools. The application being built in this lab is a simple read-only representation of the sort of application that might be used to manage and view entries in a real estate agent's office. The techniques used could easily be applied to nearly any data-driven client application scenario.

Overview

In this lab, you will learn all the necessary steps for creating and customizing a master-detail business form in WPF 4.0 using Visual Studio 2010 tools.

Objectives

Once you have completed this lab you will understand:

  • How to use the Data Sources window with a WPF project, to create initial scaffolding for the data bindings of your application
  • How to use the Data Sources window to “paint” a databinding on an existing WPF control
  • How to create master-detail scaffolding with the Data Sources window
  • How to customize the output of the data sources window to create custom visuals using the Databinding expression builder in the Visual Studio 2010 property browser
  • How to use markup extension intellisense to create databinding expressions
  • How to extract a common look into a resource using the extract resource feature of Visual Studio 2010
  • How to apply a common look to a control using the resource picker feature of Visual Studio 2010

Scenario

The application being built in this lab is a simple read-only representation of the sort of application that might be used to manage and view entries in a real estate agent’s office. The techniques used could easily be applied to nearly any data-driven client application scenario.

Prerequisites

You should have a basic familiarity with the following products or technologies before you begin this lab:

  • Data-driven application UI development
  • Windows Presentation Foundation

System Requirements

You must have the following items to complete this lab:

  • Microsoft Visual Studio 2010
  • .NET Framework 4

Setup

All the requisites for this lab are verified using the Configuration Wizard. To make sure that everything is correctly configured, follow these steps:

Note:
To perform the setup steps you need to run the scripts in a command window with administrator privileges.

  1. Run the Configuration Wizard for the Training Kit if you have not done it previously. To do this, browse to Source\Setup folder of this lab, and double-click the Dependencies.dep file. Install any pre-requisites that are missing (rescanning if necessary) and complete the wizard.

    Note:
    The Configuration Wizard is used for checking dependencies and setting up the environment. If the Configuration Wizard is not installed on your machine, you must install it running the DependencyChecker.msi file located on the %VS2010TKInstallationFolder%\Assets\DependencyChecker folder (e.g. by default the Training Kit is installed under C:\VS2010TrainingKit).

    For convenience, much of the code you will be managing along this lab is available as Visual Studio code snippets. The Dependencies.dep file launches the Visual Studio installer file that installs the code snippets.

Exercises

This Hands-On Lab is comprised by the following exercises:

  • Creating the Application’s Data Scaffolding
  • Creating Master-Detail Scaffolding
  • Creating and Using Resources

Estimated time to complete this lab: 45 minutes.

Note:
Each exercise is accompanied by an End folder containing the resulting solution you should obtain after completing the exercises. You can use this solution as a guide if you need additional help working through the exercises.

Note:
Each exercise contains a Visual Basic and a C# version; Inside the End/Begin solution folder you will find two folders: VB, containing the Visual Basic version of the exercise, and C#, containing the C# version of it.

For More Information

See the following videos in which this application is built up:

Next Step

Exercise 1: Creating the Application’s Data Scaffolding, Making Basic Customizations