开发者

How to force AutoCompleteBox control to populate the ItemSource only after n chars are entered?

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;
  autoC开发者_如何转开发ompCity.ItemsSource = GetCityList(SelectedState, SelectedCountry);
 }


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜