ComponentOne List for WinForms
Styling and Appearance / Style List
In This Topic
    Style List
    In This Topic

    List allows you to apply styling to change the look and appearance of your application. It comes with many built-in options which can be used to change the background color, border, and much more.

    List provides various properties which can be used to style the appearance of the control. It lets you set the foreground and background color of the control by using ForeColor and BackColor properties of the Style class, respectively.

     

    Use the following code to set the background and foreground color of the List control.

    C#
    Copy Code
    c1List1.Style.BackColor = Color.Lavender;
    c1List1.Style.ForeColor = Color.Purple;
    c1List1.Style.Borders.Color = Color.DarkMagenta;
    

    Set Alternate Row

    List allows you to style the control by creating alternate rows. To achieve this, you can set the AlternatingRows property of the C1List class to true.

     

    The following code demonstrates how to enable alternating rows in the List control.

    C#
    Copy Code
    c1List1.AlternatingRows = true;
    

    Besides this, you can also set the alternating rows using the C1List Tasks smart tag panel. For more information, see C1List Tasks smart tag panel.

    Set Image as Background

    To set the background image on a list, you can use BackgroundImage property of the Style class by specifying the path of the image file.

    The following code demonstrates how to set image as background in the List control.

    C#
    Copy Code
    //set background image
    c1List1.Style.BackgroundImage = Image.FromFile("../.../images.jpg");
    

    Furthermore, you can also set the foreground image using ForegroundImage property of the Style class. For more information, see Display Images.

    See Also