Articles in this section
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.


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 == "," )
        if(iBoldedIndex >= e.List.SelectedItem.BoldedItems.Count )
           e.List.SelectedItem.BoldedItems.SelectedItem = null;
           e.List.SelectedItem.BoldedItems.SelectedItem = e.List.SelectedItem.BoldedItems[iBoldedIndex];



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
      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
   e.List.SelectedItem.BoldedItems.SelectedItem = e.List.SelectedItem.BoldedItems(iBoldedIndex)
           End If
   End If
End Sub


Reference link:

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment