Step 2 of 4: Adding C1Window Controls

In the previous step you created a new project and added button controls to the application. In this step you'll continue by adding a C1Window control in a user control.

Complete the following steps:

1.   Right-click the project in the Visual Studio Solution Explorer and select the Add | New Item option. The Add New Item dialog box will open.

2.   In the  Add New Item dialog box, select the WPF item on the left and in the right Templates section choose User Control (WPF), name the new control "MyWindow.xaml" and click Add to add the new user control. If it does not open automatically, double-click the MyWindow.xaml file in the Solution Explorer to open it.

3.   Navigate to the Toolbox and double-click the TextBlock item to add the control to the form.

4.   Set the TextBlock's Text property to "Hello World!" The user control's XAML markup will now appear similar to the following:

<UserControl x:Class="MyWindow"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="300" Height="300">

    <Grid>

        <TextBlock Height="21" HorizontalAlignment="Left" Margin="10,10,0,0" Name="TextBlock1" VerticalAlignment="Top" Width="120" Text="Hello World!" />

    </Grid>

</UserControl>

Note that you can add additional controls to the form, if you choose – items you add will be included in the body of the C1Window control.

You've successfully set up your application's user interface, but if you run your application right now the buttons will do nothing when pressed. In the next step you'll add code to your application to add functionality to the controls.


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.