views:

35

answers:

1

Is it possible to force AutoCompleteBox control in SilverLight application to start obtaining ItemSource data only after n chars are entered (the data with the filtering mode StartsWith?

Thanks,

Here is the way I bind my ItemsSources (Basically there is a comboBox which stands for Stetes. And once a state is selected I set itemsSource of the AutoCompleteBox control. But it seems even before I type 3 chars the Db call is done -checked by SQL Profiler-):

This is my XAML :

<input:AutoCompleteBox Name="autoCompCity" Grid.Column="1" Grid.Row="2" 
HorizontalAlignment="Left"  VerticalAlignment="Bottom" Width="180"
MinimumPopulateDelay="10" MinimumPrefixLength="3" 
FilterMode="StartsWith" MaxDropDownHeight="150"  
ValueMemberPath="CityName" Text="Enter city" 
IsTextCompletionEnabled="True"></input:AutoCompleteBox>

And my code-behind:

private void comboState_SelectionChanged(object sender
, SelectionChangedEventArgs e)
     {
      if (SelectedState== null)
       return;
       BindCityAutoCompleteBox();
     }


private void BindCityAutoCompleteBox()
 {
  autoCompCity.IsEnabled = true;
  autoCompCity.ItemsSource = GetCityList(SelectedState, SelectedCountry);
 }
A: 

Set the MinimumPrefixLength property to the number of characters you want.

AnthonyWJones
@AnthonyWJones : I dont think it helps. maybe the reason is bcoz of the way I bind my ItemsSources on the code behind. I am about to add how I bind it on my question.
burak ozdogan