OpenDropDownOnFocus="True" Leaves DropDown Open when fast tabbing.

6 posts, 0 answers
  1. Chris
    Chris avatar
    19 posts
    Member since:
    Jul 2011

    Posted 13 Jan Link to this post

    So there's multiple RadComboBox's nested in a ScrollViewer each with OpenDropDownOnFocus=True

     The problem is if you hold down tab, then even AFTER each control loses focus, many of them still keep their dropdown part open resulting in a lot of stacked up dropdowns open which is obviously undesired. Is there some lost focus timer or something I'm missing to keep this from happening and to actually ensure every drop down closes as soon as the control loses focus?

     

    Thanks!

  2. Chris
    Chris avatar
    19 posts
    Member since:
    Jul 2011

    Posted 14 Jan in reply to Chris Link to this post

    I kind of expected no re-response. So if anyone else runs into this. All I did was attach to the LostFocus and property change IsDropDownOpen to False to politely remind the control again to close it's damn drop down even if the user is speeding through through focusing.

     Cheers!

  3. DevCraft banner
  4. Chris
    Chris avatar
    19 posts
    Member since:
    Jul 2011

    Posted 14 Jan in reply to Chris Link to this post

    Correction, I didn't notice immediately but my previous answer is a no go. Since focus is passed to the dropdown if a user tries to mouse to their selection they cant hit because the DropDown gets closed using my previous statement, so disregard. Still looking for a solution.
  5. Georgi
    Admin
    Georgi avatar
    350 posts

    Posted 18 Jan Link to this post

    Hello Chris,

    You can prevent the DropDown to stay open by closing it using Dispatcher:

    protected override void OnLostFocus(RoutedEventArgs e)
           {
               if (!this.IsKeyboardFocusWithin)
               {
                   Dispatcher.BeginInvoke(new Action(() =>
                   {
                       if (this.IsDropDownOpen)
                       {
                           this.IsDropDownOpen = false;
                       }
                   }));
               }
               base.OnLostFocus(e);
           }

    More on the described approach you can find in the attached project. So it would be great if you could give it a try and let us know if this works for you.

    Looking forward to your reply.

    Regards,
    Georgi
    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
  6. Chris
    Chris avatar
    19 posts
    Member since:
    Jul 2011

    Posted 18 Jan in reply to Georgi Link to this post

    Thanks for the reply! What I ended up doing was just using the VisualStateManager Unfocused VisualState to throw IsOpen to False. Seems to work fine and just applied it to both default templates so it's global. Thank you again!
  7. Georgi
    Admin
    Georgi avatar
    350 posts

    Posted 19 Jan Link to this post

    Hello Chris,

    I am glad that you were able to find the most suitable solution to your scenario.

    Also If you have any other questions or concerns, please don't hesitate to write us.

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