OpenDropDown On focus

9 posts, 1 answers
  1. Siddhant
    Siddhant avatar
    22 posts
    Member since:
    Jan 2013

    Posted 18 Jan 2013 Link to this post

    I want a AutoCompleteBox in which the drop down opens as soon as it get focus on down arrow is pressed
  2. Answer
    Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 21 Jan 2013 Link to this post

    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.

  3. DevCraft banner
  4. Siddhant
    Siddhant avatar
    22 posts
    Member since:
    Jan 2013

    Posted 22 Jan 2013 Link to this post

    Thanks a Lot
    worked Perfectly
  5. Guga
    Guga avatar
    29 posts
    Member since:
    May 2012

    Posted 24 Jan 2013 Link to this post

    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.
  6. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 29 Jan 2013 Link to this post

    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.

  7. Nate
    Nate avatar
    3 posts
    Member since:
    Jul 2013

    Posted 29 Jul 2013 Link to this post

    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

  8. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 30 Jul 2013 Link to this post

    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 >>
  9. Nate
    Nate avatar
    3 posts
    Member since:
    Jul 2013

    Posted 07 Aug 2013 Link to this post

    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
  10. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 08 Aug 2013 Link to this post

    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 >>
Back to Top
DevCraft banner