In this step you'll begin in Visual Studio to create a WPF application using Windows for WPF. In this step you’ll add two buttons and a text box to the form. The buttons ill open modal and modal C1Window dialog windows.
To set up your project and add a C1Window control to your application, complete the following steps:
1. In Visual Studio 2008, select File | New | Project.
2. In the New Project dialog box, select a language in the left pane, and in the templates list select WPF Application. Enter a Name for your project and click OK. The project will be created and a form will appear. For more information about creating a WPF project, see Creating a .NET Project in Visual Studio.
3. Right-click the project in the Solution Explorer window and select Add Reference.
4. In the Add Reference dialog box, locate and select the C1.WPF.dll assembly and click OK to add a reference to your project.
5. Click once on the form to select it, navigate to the Visual Studio Toolbox, and add a TextBlock and two Button controls (double-clicking on an item in the Toolbox to add it to the form).
6. Resize the form, and resize the controls on the form.
7. Select each control in turn, and set the following properties for each in the Properties window:
• Set TextBlock1's Text property to "Click a button to open a dialog window:"
• Set Button1's Content property to "Open a modeless window."
• Set Button2's Content property to "Open a modal window."
The XAML markup will appear similar to the following:
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ComponentOne Windows for WPF" Height="220" Width="368">
<Grid>
<TextBlock Height="23" Margin="10,10,31,0" Name="TextBlock1" VerticalAlignment="Top" Text="Click a button to open a dialog window:" />
<Button Height="23" Margin="10,41,148,0" Name="Button1" VerticalAlignment="Top">Open a modeless window.</Button>
<Button Margin="10,74,148,0" Name="Button2" Height="23" VerticalAlignment="Top">Open a modal window.</Button>
</Grid>
</Window>
The form will appear similar to the following image:
What You've Accomplished
You've successfully created a WPF application and added controls to the form. In the next step you'll add and customize the C1Window control.