)
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 load intellisense function from XML in WinForms SyntaxEditor (EditControl)?

Platform: WinForms |
Control: EditControl |
Published Date: January 29, 2015 |
Last Revised Date: December 11, 2019

Load intellisense function

In EditControl, you can achieve the intellisense functionality as achieved in Visual Studio, by handling its ContextChoiceOpen event. The following code example illustrates the same.

C#

private void editControl1_ContextChoiceOpen(Syncfusion.Windows.Forms.Edit.Interfaces.IContextChoiceController controller)
{
   reader = new XmlTextReader(intellisensePath);
   while (reader.Read())
   {
      string itemname = "", tooltip = "", category = "";
      switch (reader.NodeType)
      {
         case (XmlNodeType.Element):
                 if (reader.Name == "Items")
                 {
                    if (reader.AttributeCount > 0)
                    {
                       while (reader.MoveToNextAttribute())
                       {
                          if (reader.Name == "Name")
                          {
                             itemname = reader.Value;
                          }
                          if (reader.Name == "Tooltip")
                          {
                             tooltip = reader.Value;
                          }
                          if (reader.Name == "Category")
                          {
                            category = reader.Value;
                          }
                          if (reader.Name == "Image")
                          {
                             if (category.ToLower() == "class" && isParentClass)
                                controller.Items.Add(itemname, tooltip,  this.editControl1.ContextChoiceController.Images[0]);
                             if (category.ToLower() == "method" && (isParentClass || isChildClass || isMethod))
                                controller.Items.Add(itemname, tooltip, this.editControl1.ContextChoiceController.Images[1]);
                             if (category.ToLower() == "cmethod" && (isMethod || isCMethod))
                                controller.Items.Add(itemname, tooltip, this.editControl1.ContextChoiceController.Images[1]);
                             if (category.ToLower() == "property" && (isParentClass || isChildClass))
                                controller.Items.Add(itemname, tooltip, this.editControl1.ContextChoiceController.Images[2]);
                          }
                     }
                 }
             }
             break;
        }
    }
}

VB

Private Sub GetFunctionNames(ByVal e As ContextPromptUpdateEventArgs)
    reader = New XmlTextReader(intellisensePath)
[function] = ""
    Dim i As Integer = 1
    Do While reader.Read()
    [function] = ""
    Select Case reader.NodeType
    Case (XmlNodeType.Element)
             If reader.Name = "Function" Then
                reader.MoveToFirstAttribute()
             If reader.Value = Me.contextPromptLexem Then
                Do While reader.MoveToNextAttribute()
                     If reader.Name = "overloads" & i Then
                        [function] = reader.Value
                     ElseIf reader.Name = "Description" & i Then
                             e.AddPrompt([function], reader.Value)
                             i += 1
                     End If
               End If
               Loop
          End If
       End If
    End Select
    Loop
End Sub

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/Intellisense_from_XML1834281398.zip

Reference link: https://help.syncfusion.com/windowsforms/syntax-editor/intellisense#populate-intellisense-pop-up

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