New to Telerik UI for WinFormsStart a free 30-day trial

Formatting Items

Updated over 1 year ago

Formatting RadCheckedDropDownList is easy and can be separated in two parts:

Formatting the editable area

In order to customize the editable area, you must subscribe to the TextBlockFormatting event and modify the properties of the TokenizedTextBlockElement:

Subscribe to TextBlockFormatting

C#
this.radCheckedDropDownList1.TextBlockFormatting += radCheckedDropDownList1_TextBlockFormatting;

Modify properties

C#
void radCheckedDropDownList1_TextBlockFormatting(object sender, TextBlockFormattingEventArgs e)
{
    TokenizedTextBlockElement token = e.TextBlock as TokenizedTextBlockElement;
    if (token != null)
    {
        token.ForeColor = Color.DarkBlue;
        token.DrawFill = false;
        token.BorderColor = Color.DarkRed;
        token.BorderWidth = 1.3f;
        token.DrawBorder = true;
        token.BorderGradientStyle = GradientStyles.Solid;
    }
}

Figure 1: Customizing tokens

WinForms RadCheckedDropDownList Customizing Tokens

Formatting the drop down items

Customizing the drop down items is similar. Subscribe to the VisualListItemFormatting event:

Subscribe to VisualListItemFormatting

C#
this.radCheckedDropDownList1.VisualListItemFormatting += radCheckedDropDownList1_VisualListItemFormatting;

Modify properties

C#
void radCheckedDropDownList1_VisualListItemFormatting(object sender, VisualItemFormattingEventArgs args)
{
    bool itemChecked = ((RadCheckedListDataItem)args.VisualItem.Data).Checked;
    if (itemChecked)
    {
        args.VisualItem.ForeColor = Color.Green;
    }
    else
    {
        args.VisualItem.ForeColor = Color.Red;
    }
}

Figure 2: Customizing dropdown items

WinForms RadCheckedDropDownList Customizing Dropdown Items