vijay rags

vijay rags

  • NA
  • 68
  • 163.7k

How to create intellisense textbox in silverlight 4

Dec 15 2011 4:45 AM
Hi,

   I have a autocompletebox and bind it with a list of item(cities). But its throwing error message while binding source.
Please help.

Sample Code:

xaml:
  <sdk:AutoCompleteBox x:Name="txtSearchName" Grid.Row="0" Grid.Column="3" MinWidth="250" MaxWidth="300" Height="22" HorizontalAlignment="right"
                                 VerticalAlignment="Center" MinimumPrefixLength="1" MaxDropDownHeight="80"  >

.cs

 List<string> _Cities;
       
Main Page()
{
        Initialize Component();
         txtSearchName.ItemsSource = PopulateCities();

}

  private System.Collections.IEnumerable PopulateCities()
        {
            _Cities.Add("Boston");
            _Cities.Add("Banglore");
            _Cities.Add("Brimingham");
            _Cities.Add("Chennai");
            _Cities.Add("Chengalpattu");
            _Cities.Add("City");
            return _Cities;
        }


Thanks,
Vijay

Answers (2)