Step 1 of 3: Creating an Application with a C1TreeView Control

In this step, you'll begin in Visual Studio to create a WPF application using TreeView for WPF.

Complete the following steps:

1.   In Visual Studio, 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 to create your project. The MainWindow.xaml file should open

3.   In the XAML window of the project, place the cursor between the <Grid> and </Grid> tags and click once.

Navigate to the Toolbox and double-click the C1TreeView icon to add the treeview control to MainWindow.xaml. Note that the C1.WPF namespace and <c1:C1TreeView></c1:C1TreeView> tags have been added to the project.

4.   Remove any markup in or between the <c1:C1TreeView></c1:C1TreeView> tags. The XAML markup will now look similar to the following:

<Window x:Class="MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml">

  <Grid>

<c1:C1TreeView></c1:C1TreeView>

  </Grid>

</Window>

5.   Give your grid a name by adding x:Name="Tree" to the <c1:C1TreeView> tag so that it appears similar to the following:

<c1:C1TreeView x:Name="Tree">

By giving the control a unique identifier, you'll be able to access the C1TreeView control in code.

You've successfully created a WPF application containing a C1TreeView control. In the next step, you will customize the appearance and behavior of the C1TreeView control.


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