Category / Section
How to highlight the items in the ContextPrompt list for the current parameter in WinForms SyntaxEditor (EditControl)?
1 min read
Highlight items in context prompt
For highlighting the items in the ContextPrompt list for the current parameter to be given as an input, you need to handle the ContextPromptUpdate event. Refer to the code snippets to know more about it.
C#
private void editControl1_ContextPromptUpdate(object sender, Syncfusion.Windows.Forms.Edit.ContextPromptUpdateEventArgs e) { // Select the items that should be bolded if( e.List.SelectedItem != null ) { IList list = editControl1.GetLexemsInsideCurrentStack(false); if(list == null ) return; int iBoldedIndex = 0; foreach(ILexem lexem in list ) { if(lexem.Text == "," ) iBoldedIndex++; } if(iBoldedIndex >= e.List.SelectedItem.BoldedItems.Count ) e.List.SelectedItem.BoldedItems.SelectedItem = null; else e.List.SelectedItem.BoldedItems.SelectedItem = e.List.SelectedItem.BoldedItems[iBoldedIndex]; } }
VB
Private Sub editControl1_ContextPromptUpdate(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Edit.ContextPromptUpdateEventArgs) ' Select the items that should be bolded If e.List.SelectedItem IsNot Nothing Then Dim list As IList = editControl1.GetLexemsInsideCurrentStack(False) If list Is Nothing Then Return End If Dim iBoldedIndex As Integer = 0 For Each lexem As ILexem In list If lexem.Text = "," Then iBoldedIndex += 1 End If Next lexem If iBoldedIndex >= e.List.SelectedItem.BoldedItems.Count Then e.List.SelectedItem.BoldedItems.SelectedItem = Nothing Else e.List.SelectedItem.BoldedItems.SelectedItem = e.List.SelectedItem.BoldedItems(iBoldedIndex) End If End If End Sub
Reference link: https://help.syncfusion.com/windowsforms/syntax-editor/intellisense#advanced-customizations