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

In this step, you'll create a WPF application in Visual Studio using TileListBox 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. The New WPF Application dialog box will appear.

3.   Click OK to accept default settings, close the New WPF Application dialog box, and create your project. The MainPage.xaml file should open.

4.   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.

5.   Edit the  <c1:C1TileListBox> tag to customize the control:

<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.

6.   Add markup between the <c1:C1TileListBox> and </c1:C1TileListBox> tags so it looks like the following:

<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. Note that you'll complete binding the control in code.

What You've Accomplished

You've successfully created a WPF application containing a C1TileListBox control. In the next step, Step 2 of 3: Adding Data to the TileListBox, you will add data for C1TileListBox.


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