Basic Library for WPF and Silverlight | ComponentOne
WPF and Silverlight Edition Basic Library / TreeView / TreeView Quick Start / Step 1 of 3: Creating a C1TreeView Application
In This Topic
    Step 1 of 3: Creating a C1TreeView Application
    In This Topic

    In this step, you'll create an application in Visual Studio using TreeView for WPF and Silverlight.

    Complete the following steps:

    1. In Visual Studio, select File | New Project.
    2. In the New Project dialog box, select either Windows Desktop or Silverlight from the Templates in the left-hand pane.
    New Project Dialog Box

    New Project Dialog Box

    1.    
    2. Select WPF Application or Silverlight Application, depending on the template you chose. 
    3. Enter a Name for your project, for example "QuickStart", and click OK. In a WPF Application, the MainWindow.xaml file will open.
      1. If you selected a Silverlight Application, when you click OK, the New Silverlight Application dialog box will appear.
      2. Click OK to accept default settings. This will close the New Silverlight Application dialog box and create your project.
      3. The MainPage.xaml file should open.
    4. Add the following assemblies to your application by right-clicking the References folder and selecting Add Reference:
    • WPF: C1.WPF.4.dll
    • Silverlight: C1.Silverlight.5.dll
    1. 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

    Note: The C1.WPF or C1.Silverlight.5 namespace and <c1:C1TreeView></c1:C1TreeView> tags have been added to the project.
    1. Remove any markup in or between the <c1:C1TreeView></c1:C1TreeView> tags. The XAML markup will now look similar to the following:
    XAML
    Copy Code
    <Grid>
      <c1:C1TreeView></c1:C1TreeView>
    </Grid>
    
    1. Give your grid a name by adding x:Name="Tree" to the <c1:C1TreeView> tag so that it appears similar to the following:
    XAML
    Copy Code
    <c1:C1TreeView 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 or Silverlight application containing a C1TreeView control. In the next step, you will add C1TreeViewItems to the C1TreeView control.