Basic Library for WPF and Silverlight | ComponentOne
WPF and Silverlight Edition Basic Library / Windows / Windows Quick Start / Step 2 of 4: Adding C1Window Controls
In This Topic
    Step 2 of 4: Adding C1Window Controls
    In This Topic

    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 or Silverlight item on the left and in the right Templates section choose User Control (WPF) or User Control (Silverlight), 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.

    1. Navigate to the Toolbox and double-click the TextBlock item to add the control to the form.
    2. Set the TextBlock's Text property to "Hello World!" The user control's XAML markup will now appear similar to the following:
    XAML
    Copy Code
    <Grid>
       <TextBlock Height="21" HorizontalAlignment="Left" Margin="10,10,0,0" Name="TextBlock1" VerticalAlignment="Top" Width="120" Text="Hello World!" />
    </Grid>
    

    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.