AutoComplete TextBox Multiple Entries Comma Separa

2020-07-25 10:56发布

问题:

Is there any way of making a TextBox widget that autocompletes, but allows you to autocomplete each time you have a separator, for example a ",".

Let's say I want to write a list of fruits in a textbox, for example:

"Apples, Pears"

...and my list of valid entries is let's say [ Apples, Pears, Oranges, Clementines ] so each time I type a comma it resets the autocompletion, so that for example "A" was autocompleted to "Apples", but then typing a comma and then typing "Pe" will auto-complete to "Pears".

Big ask I know, but just in case...

回答1:

I suggest to take a look at this Autocomplete Textbox from there you use Regular Expressions to split the input text with commas and separate them and just populate again the control to whatever the result was. Hope it helps!