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.
Unfortunately, activation email could not send to your email. Please try again.

How do I accomplish multiple levels of context choice list implementation in the EditControl?

 

Multiple levels of context choice list can be implemented by handling the ContextChoiceBeforeOpen and ContextChoiceOpen event.

C#

private void editControl1_ContextChoiceBeforeOpen(object sender, System.ComponentModel.CancelEventArgs e)

{


ILexem lex;


lex = this.editControl1.ContextChoiceController.LexemBeforeDropper as ILexem;


if ((lex.Text == "this") || (lex.Text == "me"))


firstLevel = true;


else if (ContextChoiceListPresenceCheck(contextChoiceListLevelOne, lex.Text) == true)


secondLevel = true;


else


e.Cancel = true;

}

 

private void editControl1_ContextChoiceOpen(Syncfusion.Windows.Forms.Edit.Interfaces.IContextChoiceController controller)

{


if (firstLevel == true)


{


controller.Items.Clear();


for (int i=0; i<contextChoiceListLevelOne.Length; i++)


{


controller.Items.Add(contextChoiceListLevelOne[i], "This is a" + contextChoiceListLevelOne[i], this.editControl1.ContextChoiceController.Images[i]);


}


}


else if (secondLevel == true)


{


controller.Items.Clear();


for (int i=0; i<contextChoiceListLevelOne.Length; i++)


{


controller.Items.Add(contextChoiceListLevelTwo[i], "This is a" + contextChoiceListLevelTwo[i], this.editControl1.ContextChoiceController.Images[i]);


}


}


firstLevel = false;


secondLevel = false;

}

 

VB

Private Sub editControl1_ContextChoiceBeforeOpen(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles editControl1.ContextChoiceBeforeOpen

Dim lex As ILexem

lex = CType(IIf(TypeOf Me.editControl1.ContextChoiceController.LexemBeforeDropper Is ILexem, Me.editControl1.ContextChoiceController.LexemBeforeDropper, Nothing), ILexem)


If (lex.Text = "this") OrElse (lex.Text = "me") Then


firstLevel = True


Else If ContextChoiceListPresenceCheck(contextChoiceListLevelOne, lex.Text) = True Then


secondLevel = True


Else


e.Cancel = True


End If

End Sub


Private Sub editControl1_ContextChoiceOpen(ByVal controller As Syncfusion.Windows.Forms.Edit.Interfaces.IContextChoiceController) Handles editControl1.ContextChoiceOpen


If firstLevel = True Then


controller.Items.Clear()


Dim i As Integer=0


Do While i < contextChoiceListLevelOne.Length


controller.Items.Add(contextChoiceListLevelOne(i), "This is a" & contextChoiceListLevelOne(i), Me.editControl1.ContextChoiceController.Images(i))


i += 1


Loop


ElseIf secondLevel = True Then


controller.Items.Clear()


Dim i As Integer=0


Do While i < contextChoiceListLevelOne.Length


controller.Items.Add(contextChoiceListLevelTwo(i), "This is a" & contextChoiceListLevelTwo(i), Me.editControl1.ContextChoiceController.Images(i))


i += 1


Loop


End If


firstLevel = False


secondLevel = False

End Sub

Article ID: Published Date: Last Revised Date: Platform: Control:
392 04/30/2011 07/10/2014 Windows Forms EditControl
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.