ComponentOne List for WinForms
In This Topic
    Displaying Allowable Values as Radio Buttons
    In This Topic

    If the number of allowable values for a column is relatively small, you may want to consider a radio button presentation. At design time, go to the C1List Designer, then to the ValueItems node for the column and set the Presentation property to RadioButton. Or, in code:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1List1.Columns("Country").ValueItems.Presentation = C1.Win.C1List.PresentationEnum.RadioButton
    

    To write code in C#

    C#
    Copy Code
    this.c1List1.Columns["Country"].ValueItems.Presentation = C1.Win.C1List.PresentationEnum.RadioButton;
    

    If necessary, adjust the Width property of the column style and the ItemHeight property of the list to accommodate all of the items.

    For a given cell, if the underlying data does not match any of the available values, none of the radio buttons will be selected for that cell. However, you can provide a default ValueItem object that will be selected instead.

    In this example, the last ValueItem has an empty Value property, but the DisplayValue is set to "Other". This means that when Country fields that do not match any of the items are displayed, their value in the list will be displayed as Other.

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1List1.Columns("Country").ValueItems.DefaultItem = 5
    

    To write code in C#

    C#
    Copy Code
    this.c1List1.Columns["Country"].ValueItems.DefaultItem = 5;
    

    In this example, 5 is the zero-based index of the default item.