some time ago I wrote a custom GridEditor using a TextBoxControlElement with AutoComplete = Suggest.
It works fine but now i need to change the auto complete logic using Contains instead of StartsWith.
I know how to do this in a DropDownList or in a DropDownListElement but can't find a way to get this behaviour in a TextBoxControl and don't want to change the TextBoxControlElement with a DropDownListElement hiding the arrow button.
How can I have a 'contains' AutoComplete in a TextBoxControls ?
4 Answers, 1 is accepted
In order to activate "contains" autocomplete functionality in RadTextBoxControl, you can simply set the AutoCompleteMode property to AutoCompleteMode.Suggest:
Please refer to the following help article which gives you additional information about the autocomplete behavior: https://docs.telerik.com/devtools/winforms/editors/textboxcontrol/autocomplete
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
thanks for your answer.
Your code is almost identical at mine, but in this way I obtain a 'StartsWith' autocomplete and not a 'Contains'.
In fact the first line of the documentation says : "The RadTextBoxControl can automatically complete the input string by comparing the prefix being entered to the prefix of all strings in the maintained source."
What I want is to compare the text entered with the strings in the data source looking for those that "contains" the input string.
With a drop down I can obtain this behaviour simply writing :
or replacing the AutoCompleteSuggestHelper class if I need a more complex matching criteria
The TextBoxControl doesn't seem to support none of this ways, so how can I get a SuggestMode.Contais behaviour ?
Note that RadTextBoxControl and RadDropDownList have a completely different auto-complete implementation. Indeed, RadDropDownList offers different auto-complete helpers for handling the "starts with" or "contains" functionality. But they are not available in RadTextBoxControl. The previously suggested solution was not quite correct in terms of the exact requirement that you are trying to achieve. Please excuse me for that. In order to show the items that "contains" the text, you can use the following custom implementation of RadTextBoxControl:
Should you have further questions please let me know.
thanks for your help, this is exactly what I needed