This is a migrated thread and some comments may be shown as answers.

AutoComplete is not working

3 Answers 273 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Ramesh
Top achievements
Rank 1
Ramesh asked on 15 Mar 2013, 02:30 PM
Hi Experts,

I have tried your AutoCompleteBox with the following code, but it is not working. I could not get any suggesstions and the dropdown list is not showing any suggesstion list. Simply the control works like a TextBox only. Please help me, what is my wrong.

<Window x:Class="Interactivity_Behavior_Demo.MainWindow"
        xmlns:local="clr-namespace:Interactivity_Behavior_Demo.Behavior"
        Title="Test Demo"
        Width="525"
        Height="350">
  
      
        <Telerik:RadAutoCompleteBox Name="autocomp" Loaded="autocomp_Loaded_1" Height="30" Width="120"/>
         
</Window
  
public MainWindow()
        {
            InitializeComponent();
            _Source = new ObservableCollection<string>() { "hello", "abc", "123" };
            autocomp.ItemsSource = Source;
        }
    
private void autocomp_Loaded_1(object sender, RoutedEventArgs e) 
        
            autocomp.IsDropDownOpen = true; 
            autocomp.AutoCompleteMode = Telerik.Windows.Controls.Primitives.AutoCompleteMode.Suggest; 
            autocomp.TextSearchMode = Telerik.Windows.Controls.TextSearchMode.StartsWith; 
        }

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Mar 2013, 06:34 AM
Hi Ramesh,

I tried your code with a few modifications and its working fine at my end. You have given a wrong variable name while setting the ItemsSource and you have initialized the ObservableCollection without specifying the type. Please have a look into the following code.

XAML:
<telerik:RadAutoCompleteBox HorizontalAlignment="Left" Margin="34,64,0,0" Name="autocomp" VerticalAlignment="Top" Width="224" Loaded="radAutoCompleteBox1_Loaded" />

C#:
public MainWindow()
{
    InitializeComponent();
    ObservableCollection<string> _Source = new ObservableCollection<string>() { "hello", "abc", "123" };
    autocomp.ItemsSource = _Source;
}
 
private void radAutoCompleteBox1_Loaded(object sender, RoutedEventArgs e)
{
    autocomp.IsDropDownOpen = true;
    autocomp.AutoCompleteMode = Telerik.Windows.Controls.Primitives.AutoCompleteMode.Suggest;
    autocomp.TextSearchMode = Telerik.Windows.Controls.TextSearchMode.StartsWith;
}

Thanks,
Princy.
0
Ramesh
Top achievements
Rank 1
answered on 18 Mar 2013, 02:47 PM
Princy,
Thanks for your response.

This is working fine when i have the control seperately.

But i am using this inside RadGrid cell, when i have this inside the with CellEditTemplate and clicking the cell throws null exception.
Also i dont know what i have to add in "CellTemplate", please help me by providing code for both "CellTemplate" and "CellEditTemplate" with AutoCompleteBox.

Thanks,
Ramesh
velusamyr@hcl.com
0
Vladi
Telerik team
answered on 21 Mar 2013, 08:59 AM
Hi Ramesh,

We created and attached a sample project for you that shows how to create a CellEditTemplate and CellTemplate with RadAutoCompleteBox in RadGridView.

Hope this is helpful.

Greetings,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
AutoCompleteBox
Asked by
Ramesh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ramesh
Top achievements
Rank 1
Vladi
Telerik team
Share this question
or