New to Telerik UI for WinForms? Start a free 30-day trial
Formatting Blocks
Updated over 1 year ago
The RadAutoCompleteBox allows appearance customization of each instance of ITextBlock. This can be easily achieved by subscribing to the FormattingTextBlock event:
C#
void radAutoCompleteBox1_TextBlockFormatting(object sender, TextBlockFormattingEventArgs e)
{
TokenizedTextBlockElement token = e.TextBlock as TokenizedTextBlockElement;
if (token != null)
{
token.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
token.BackColor = Color.Yellow;
}
}
Figure 1: Items with yellow background.

Note that the event occurs when the text blocks are repositioned. This happens in different cases - editing, control resizing and etc. Hence, you should subscribe to the event before initializing the Text property.