This is a migrated thread and some comments may be shown as answers.
Autocompletebox item count limit and validation
3 Answers 21 Views
This is a migrated thread and some comments may be shown as answers.
Luis
Top achievements
Rank 2
Luis asked on 20 May 2016, 09:17 PM

Hello there!

 

Im trying to accomplish these 2 taks:

 

 -  To limit the amount of items added by the AutoCompleteBox

-  To retrieve the AutoCompleteValueMember after a TextBlock is added

 

So far i tried with the event CreateTextBlock but, the event fires every time i type a key , i was looking the documentation and i cant seem to find an event that fires after a TextBlock is added.

 

Any help would be appreciated.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Sr.
Telerik team
answered on 25 May 2016, 08:55 AM
Hello Luis,

Thank you for writing. 

In order to limit the tokens, you can use the RadAutoCompleteBox.TokenValidating event and set the TokenValidatingEventArgs.IsValidToken property to false if the RadAutoCompleteBox.Items collection exceeds the limit.

As to the question about detecting when a token is created, indeed, the CreateTextBlock event is appropriate. However, you need to check the TextBlock:
private void radAutoCompleteBox1_CreateTextBlock(object sender, Telerik.WinControls.UI.CreateTextBlockEventArgs e)
{
    if (e.TextBlock is TokenizedTextBlockElement)
    {
        //TODO
    }
}


I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Luis
Top achievements
Rank 2
answered on 26 May 2016, 11:13 PM

Thanks for the answer, but i found another workaround earlier.

 

Thanks anyways.

0
Dess | Tech Support Engineer, Sr.
Telerik team
answered on 31 May 2016, 08:26 AM
Hello Luis,

Thank you for writing back. 

I am glad that you have found a suitable solution for your case. Feel free to share it in the forum in order the community to benefit from it. Thank you in advance.

If you have any additional questions, please let me know.

Regards,
Dess
Telerik
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Asked by
Luis
Top achievements
Rank 2
Answers by
Dess | Tech Support Engineer, Sr.
Telerik team
Luis
Top achievements
Rank 2
Share this question
or