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

OpenDropDown On focus

8 Answers 134 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Siddhant
Top achievements
Rank 1
Siddhant asked on 18 Jan 2013, 11:48 AM
I want a AutoCompleteBox in which the drop down opens as soon as it get focus on down arrow is pressed

8 Answers, 1 is accepted

Sort by
0
Accepted
Vladi
Telerik team
answered on 21 Jan 2013, 03:39 PM
Hi Siddhant,

In order to achieve the described behavior you will need to create a custom FilteringBehavior that will return hole collection of objects of the ItemsSource when there is no watch and the typed text in the control is empty. After that call the Populate("") method in the GotFocus event of the control.

I created and attached a sample project for you with the described approach.

Hope this is helpful.

Regards,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Siddhant
Top achievements
Rank 1
answered on 22 Jan 2013, 06:20 AM
Thanks a Lot
worked Perfectly
0
Guga
Top achievements
Rank 1
answered on 25 Jan 2013, 03:35 AM
Did you make any changes to the control on the latest development version (2012.3.1129.1050) that might have created some weird behavior?

i.e. drop down only opening after typing a couple of spaces and backspaces. After that opens up on mouse click as it is supposed to...

?? Might be a conflict with another control taking the focus away from the autocompletebox... Just want to eliminate possible sources.

Thanks.
0
Vladi
Telerik team
answered on 29 Jan 2013, 09:28 AM
Hello,

The example project attached previously was tested with 2012.3.1129.1050 and our latest internal build and we could reproduce the described issue.

Have you made any customizations to the example project attached previously and if yes could you describe them to us? Also are you able reproduce the issue in the NoMatchFilteringBehavior.zip project or in your project?

All the best,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Nate
Top achievements
Rank 1
answered on 29 Jul 2013, 08:25 PM
Hi Vladi,

I am trying to modify your example to allow the box to drop down when clicked as opposed to only when focused for the first time.  This way multiple values can be entered without the user having to remove focus from the control.

I added a MouseLeftButtonUp event handler and put the same code as was in the GotFocus event handler.  However the MouseLeftButtonUp does not seem to get called all the time.  It only seems to get called if enough items have been added to the box that it expands multiple lines, and you click near the top of the box.  It appears the portion of the control where the user can type is blocking the MouseLeftButtonUp event from being raised for the control.

Thanks
-Nate

0
Vladi
Telerik team
answered on 30 Jul 2013, 10:47 AM
Hello,

The MouseLeftButtonUp and MouseLeftButtonDown events are handled by the control and in order to override them you will need to either:
  • Create a custom RadAutoCompleteBox control and override that method in the custom class.

or

  • Use the AddHandler() method to add a handled for the MouseLeftButtonUpEvent and make sure that you set handledEventsToo to true. The next code snippet shows how to handle the handled event:

<telerik:RadAutoCompleteBox x:Name="AutoCompleteBox" .../>

and in the code behind:
public Example()
{
    InitializeComponent();
    this.AutoCompleteBox.AddHandler(RadAutoCompleteBox.MouseLeftButtonUpEvent, new MouseButtonEventHandler(RadAutoCompleteBox_MouseLeftButtonUp), true);
}
 
private void RadAutoCompleteBox_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
    var autoCompleteBox = sender as RadAutoCompleteBox;
    if (string.IsNullOrEmpty(autoCompleteBox.SearchText))
    {
        autoCompleteBox.Populate("");
    }
    else
    {
        autoCompleteBox.Populate(autoCompleteBox.SearchText);
    }
}

Hope this is helpful.


Regards,
Vladi
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Nate
Top achievements
Rank 1
answered on 07 Aug 2013, 06:40 PM
Hi again,

I am having a problem similar to Guga.  I create a ticket with an example:
http://www.telerik.com/account/support-tickets/view-ticket.aspx?threadid=724333
0
Vladi
Telerik team
answered on 08 Aug 2013, 10:22 AM
Hi,

This is a known issue that has been fixed in our latest released version of RadControls.

Could you download the latest version and let us know if the issue persists.

Regards,
Vladi
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
AutoCompleteBox
Asked by
Siddhant
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Siddhant
Top achievements
Rank 1
Guga
Top achievements
Rank 1
Nate
Top achievements
Rank 1
Share this question
or