ComponentOne List for WinForms
Data Binding / Unbound Mode
In This Topic
    Unbound Mode
    In This Topic

    As the name suggests, in unbound mode, list is not bound to any data source and data is stored in the control itself. For List, you need to create unbound columns and provide data by adding list items programmatically in unbound mode.

    Let us now discuss how to create unbound columns in unbound mode.

    Create Unbound Columns

    Unbound columns are the columns that do not have the DataField property set, but do have the column Caption property set.

    You can add unbound columns to the list by using Add and Insert methods of the C1DataColumnCollection class. The Insert method allows you to specify the position where you wish to add a new column and the Add method adds a column at the end. You can also use HoldFields method of the C1List class to set the layout for the added column. Additionally, you can provide a name to the unbound column by setting its Caption property.

    The following code demonstrates how to add an unbound column in the List.

    C#
    Copy Code
    C1DataColumn Col = new C1DataColumn();
    //insert unbound column
    c1List1.Columns.Insert(0, Col);
    //set caption
    Col.Caption = "Unbound";
    c1List1.HoldFields();