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

Selection disabled on left click

1 Answer 77 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 10 Jul 2015, 08:01 AM

Hy Team !
I am showing the DropDown menu on focus with this code :

private void RadAutoCompleteBox_GotFocus(object sender, RoutedEventArgs e)
        {
            var autoComplete = (RadAutoCompleteBox)sender;
            string searchText = autoComplete.SearchText;
            if (autoComplete.SelectedItem != null)
            {
                searchText = BindingExpressionHelper.GetValue(autoComplete.SelectedItem, autoComplete.DisplayMemberPath).ToString();
            }
            autoComplete.Populate(searchText);
        }

 

This works but it also disable the left click when I try to select something from this list. Every other way are working (right click, keyboard control, ...) just the left click doesn't.

So what can I do to fix this issue ?

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 13 Jul 2015, 12:11 PM
Hello Jeremy,

The observed by you behavior of RadAutoCompleteBox could be observed when the control is not populated correctly. When the Populate method gets called you need first to check whether the DropDown is not opened:
private void radAutoCompleteBox1_GotFocus(object sender, RoutedEventArgs e)
{
    var radAutoCompleteBox = sender as RadAutoCompleteBox;
    if (!radAutoCompleteBox.IsDropDownOpen)
    {
        radAutoCompleteBox.Populate(radAutoCompleteBox.SearchText);
    }
}

Please, check the proposed above approach and let us know if it resolves your issue.

Hopes this helps.

Regards,
Nasko
Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items

Tags
AutoCompleteBox
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or