WPF and Silverlight Edition Basic Library / ListBox / TileList Box Quick Start
TileList Box Quick Start

The following quick start guide is intended to get you up and running with the C1TileListBox control. In this quick start you'll start in Visual Studio and create a new project, add C1TileListBox to your application, and customize the appearance and behavior of the control.

In this step, you'll create a WPF or Silverlight application in Visual Studio using TileListBox for WPF and Silverlight.

To set up your project, 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

New Project Dialog

  1. Select WPF Application or Silverlight Application, depending on the template you chose. 
  2. 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.
  3. 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. Place the cursor between the <Grid> and </Grid>, navigate to the Toolbox, and double-click the C1TileListBox icon to add the control to the grid. This will add the reference and XAML namespace automatically.
  1. Edit the  <c1:C1TileListBox> tag to customize the control:
XAML
Copy Code
<c1:C1TileListBox x:Name="tileListBox" ItemsSource="{Binding}" ItemWidth="130" ItemHeight="130"></c1:C1TileListBox>

This gives the control a name, sets the ItemsSource property (you'll customize this in code in a later step), and sets the size of the control. 

  1. Add markup between the <c1:C1TileListBox> and </c1:C1TileListBox> tags so it looks like the following:
XAML
Copy Code
<c1:C1TileListBox x:Name="tileListBox" ItemsSource="{Binding}" ItemWidth="130" ItemHeight="130">
    <c1:C1TileListBox.PreviewItemTemplate>
        <DataTemplate>
            <Grid Background="Gray" />
                </DataTemplate>
                </c1:C1TileListBox.PreviewItemTemplate>
                <c1:C1TileListBox.ItemTemplate>
                <DataTemplate>
                <Grid Background="LightBlue">
                    <Image Source="{Binding Thumbnail}" Stretch="UniformToFill" />
                    <TextBlock Text="{Binding Title}" Margin="4 0 0 4" VerticalAlignment="Bottom" />
               </Grid>
        </DataTemplate>
    </c1:C1TileListBox.ItemTemplate>
</c1:C1TileListBox>

This markup adds data templates for the C1TileListBox control's content. You'll complete binding the control in code in the next step.