ComponentOne List for WinForms
In This Topic
    Creating Unbound Columns
    In This Topic

    The first step in using an unbound column is creating the column itself. This may be done in the designer by adding a column through the C1List Designer. In code, unbound columns may be added using the Insert method of the C1DataColumnCollection. The column must be given a name by setting its Caption property. In the designer, this is done using the C1List Designer. In code, the Caption property of the appropriate C1DataColumn object is set. C1DataColumn objects that are added to the C1DataColumnCollection cause a corresponding C1DisplayColumn to be added to the C1DisplayColumnCollection for all splits. The default visible property of the newly added C1DisplayColumn will be True.

    If you attempt to insert an unbound column in code, you may need to use the HoldFields method to ensure that the column appears at the desired position within the list:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Dim Col As New C1List.C1DataColumn  
    Me.C1List1.Columns.Insert(0, Col)
    Col.Caption = "Unbound"   
    Me.C1List1.HoldFields()    
    Me.C1List1.Rebind()
    

    To write code in C#

    C#
    Copy Code
    C1List.C1DataColumn Col = new C1List.C1DataColumn;
    this.c1List1.Columns.Insert(0, Col);   
    Col.Caption = "Unbound";    
    this.c1List1.HoldFields();
    this.c1List1.Rebind();
    

    When the list needs to display the value of an unbound column, it fires the UnboundColumnFetch event. This event supplies the user with a row and column index as the means of identifying the list cell being requested. The Value argument to the event is of type Object, which by default is Null, but can be changed to any desired value, and will be used to fill the contents of the cell specified by the given bookmark and column index.

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Private Sub C1List1_UnboundColumnFetch(ByVal sender As Object, ByVal e As C1.Win.C1List.UnboundColumnFetchEventArgs) Handles C1List1.UnboundColumnFetch
    

    To write code in C#

    C#
    Copy Code
    private void c1List1_UnboundColumnFetch(object sender, C1.Win.C1List.UnboundColumnFetchEventArgs e)