示例#1
0
        //Auto Complete Suggestion in textbox
        void autoComplete()
        {
            RestaurantService restaurantService = new RestaurantService();

            ByNameTextBox.AutoCompleteMode   = AutoCompleteMode.Suggest;
            ByNameTextBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
            var autoComplete1 = new AutoCompleteStringCollection();

            autoComplete1.AddRange(restaurantService.GetAllByName().ToArray());
            ByNameTextBox.AutoCompleteCustomSource = autoComplete1;

            ByLocationTextBox.AutoCompleteMode   = AutoCompleteMode.Suggest;
            ByLocationTextBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
            var autoComplete2 = new AutoCompleteStringCollection();

            autoComplete2.AddRange(restaurantService.GetAllByLocation().ToArray());
            ByLocationTextBox.AutoCompleteCustomSource = autoComplete2;
        }