Spread WPF 18
GrapeCity.Wpf.SpreadSheet.CellType.Editors Namespace / GcListBox Class / Columns Property
Example


In This Topic
    Columns Property (GcListBox)
    In This Topic
    Gets a collection that contains all the columns in the control.
    Syntax
    'Declaration
     
    Public ReadOnly Property Columns As ListColumnCollection
    'Usage
     
    Dim instance As GcListBox
    Dim value As ListColumnCollection
     
    value = instance.Columns
    public ListColumnCollection Columns {get;}

    Property Value

    The columns in the control.
    Remarks

    Use the Columns collection to add columns, remove columns, or update properties on the columns.

    Each column in the Columns collection defines a column in the GcListBox. Columns in the collection must derive from GrapeCity.Windows.InputMan.ListColumn.

    The following table lists the three defined column types that the GcListBox provides.

    Column type

    Data type

    GrapeCity.Windows.InputMan.ListTextColumn

    Used to display text.

    GrapeCity.Windows.InputMan.ListCheckBoxColumn

    Used to display Boolean data.

    GrapeCity.Windows.InputMan.ListImageColumn

    Used to display image.

    In addition, you can define your own custom column by using GrapeCity.Windows.InputMan.ListTemplateColumn. If you set ListItem to System.Windows.Controls.ItemsControl.Items or System.Windows.Controls.ItemsControl.ItemsSource, the GrapeCity.Windows.InputMan.ListSubItemColumn is used to display SubItem customized in ListItem.SubItems. You can modify the Columns collection at run time regardless of whether it contains generated columns. However, if you specify columns in XAML, you should not set GrapeCity.Windows.InputMan.GcListBox.AutoGenerateColumns to true.

    You cannot add a column to the Columns collection of more than one GrapeCity.Windows.InputMan.GcListBox. If you try to do this, an System.InvalidOperationException will be thrown.

    Example
    The following code example demonstrates how to populate the Columns collection in XAML. This example is part of a larger example available in the GcListBox class overview.
    See Also