This is a migrated thread and some comments may be shown as answers.

start auto list after 3 characters

3 Answers 143 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Hitesh
Top achievements
Rank 1
Hitesh asked on 16 Jan 2013, 03:11 PM
RadAutocompleteBox is working fine.

but i have additional requirment that, auto search should start if user have entered 3 characters or more.

i can write script, but does it have property which can be helpful.

3 Answers, 1 is accepted

Sort by
0
Ivo
Telerik team
answered on 21 Jan 2013, 01:38 PM
Hi Hitesh,

In order to achieve this you will have to create a custom class deriving from the FilteringBehavior class, override the FindMatchingItems and return items only if the search string is more than 3 characters. After this you can initialize the new class in xaml and assign it to the RadAutoCompleteBox.
<Window.Resources>
   <telerik:CustomFilteringBehavior x:Key="CustomFilteringBehavior" />
</Window.Resources>
...
<telerik:RadAutoCompleteBox ItemsSource="{Binding Items}" DisplayMemberPath="Name" FileringBehavior="{StaticResource CustomFilteringBehavior}" />

All the best,
Ivo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Ralf
Top achievements
Rank 2
answered on 06 Feb 2013, 03:28 PM
Hi Ivo,
could you please post a example for the CustomFilteringBehavior

Thank you - Ralf
0
Ivo
Telerik team
answered on 08 Feb 2013, 08:49 AM
Hello Ralf,

Here is an example of a custom FilteringBehavior class:
public class CustomFilteringBehavior : FilteringBehavior
{
    public override IEnumerable<object> FindMatchingItems(string searchText, System.Collections.IList items, IEnumerable<object> escapedItems, string textSearchPath, TextSearchMode textSearchMode)
    {
        if (searchText.Length > 3)
        {
            return base.FindMatchingItems(searchText, items, escapedItems, textSearchPath, textSearchMode);
        }
 
        return Enumerable.Empty<object>();
    }
}

Kind regards,
Ivo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
AutoCompleteBox
Asked by
Hitesh
Top achievements
Rank 1
Answers by
Ivo
Telerik team
Ralf
Top achievements
Rank 2
Share this question
or