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.
精彩评论