Autocomplete box

May 12, 2010 at 10:10 PM
Edited May 12, 2010 at 10:10 PM

i would like to have autocomplete functionality to be enabled when the user presses ctrl-k on the autocomplete box.  Can i use Autocomplete box to achieve this functionality.

 

I had captured key up event , get the data to be displayed in pop-up , bind to the item source of autocomplete box. After populating itemsource i had called populate complete method. But i can't see the pop-up. Have i missed out any attributes to enable the display of pop-up.

 

Xaml :

 

  <input:AutoCompleteBox
                            IsTextCompletionEnabled="True"
                            Width="90" MinimumPrefixLength="3"
                            Grid.Row="0" Grid.Column="0" Margin="0, 0, 0, 0"
                            HorizontalAlignment="Left"        
                            IsEnabled="True"
                            Height="20"                                                                                  
                            x:Name="autoCompleteBox"                                                       
                            KeyUp="autoCompleteBox_KeyUp"  IsDropDownOpen="True"
                        >
        </input:AutoCompleteBox>

 

 

 

Code-behind

 

  private void BindSecurityDetails(DataSet data)
        {
            _dataSource.Clear();
            _dataSource.Add("1");
            _dataSource.Add("2");
            _dataSource.Add("3");
            _dataSource.Add("4");               
           

            autoCompleteBox.IsDropDownOpen = true;
            autoCompleteBox.ItemsSource = _dataSource;
            autoCompleteBox.PopulateComplete();
           
        }