)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to highlight the items in the ContextPrompt list for the current parameter in WinForms SyntaxEditor (EditControl)?

Platform: WinForms |
Control: EditControl |
Published Date: April 30, 2011 |
Last Revised Date: December 13, 2019

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

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon