Rad DropDown keyboard access

4 posts, 0 answers
  1. Syed Danish
    Syed Danish avatar
    70 posts
    Member since:
    Dec 2009

    Posted 27 Apr 2010 Link to this post

    Hi,

    We made a custom control out of the Rad DropDown Button where the Grid is the Drop Down pop up. I this control we need to have the Drop Down access through the 'Up' and 'Down' keys. We are handling this with the key press event. This works perfectly fine with the up arrow and with down arrow the Drop Down Button pop up opens, instead I need the selected value of drop down to change with out opening the pop up. Is there a way to stop the pop up from opening when the down arrow is pressed. The sample code is being attached.

      this.KeyDown += (o, e) => 
                { 
                    switch (e.Key) 
                    { 
                        case Key.Down: 
                            try 
                            { 
                                this.grid.SelectedIndex++; 
                            } 
                            catch (Exception) 
                            { 
                                this.grid.SelectedIndex = 1; 
                            } 
                            break
                        case Key.Up: 
                            try 
                            { 
                                this.grid.SelectedIndex--; 
                            } 
                            catch (Exception) 
                            { 
                                this.grid.SelectedIndex = 1; 
                            } 
                            break
                    } 
                }; 

    Will be greatfull if someone helps me out.
  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 30 Apr 2010 Link to this post

    Hi Syed,

    The easiest way is to inherit from RadDropDownButton and do nothing in the OnKeyDown override. I've created a simple project that gives one possible solution to your scenario. Have a look at it and let me know if it helps.

    Sincerely yours,
    Kiril Stanoev
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft banner
  4. Syed Danish
    Syed Danish avatar
    70 posts
    Member since:
    Dec 2009

    Posted 06 May 2010 Link to this post

    Hi Kiril,

    Thanks for the solution it worked.

    Thanks & Regards,
    Syed Danish
  5. Ivan
    Admin
    Ivan avatar
    519 posts

    Posted 06 May 2010 Link to this post

    Hello Syed,

    We are happy to hear everything is OK at your side.

    Of course if you have other questions please drop us a line.

    Best wishes,
    Ivan
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
Back to Top