Formatting Blocks
The RadAutoCompleteBox allows appearance customization of each instance of ITextBlock. This can be easily achieved by subscribing to the FormattingTextBlock event:
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;
}
}
Private Sub radAutoCompleteBox1_TextBlockFormatting(sender As Object, e As TextBlockFormattingEventArgs)
Dim token As TokenizedTextBlockElement = TryCast(e.TextBlock, TokenizedTextBlockElement)
If token IsNot Nothing Then
token.GradientStyle = Telerik.WinControls.GradientStyles.Solid
token.BackColor = Color.Yellow
End If
End Sub
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.