Menu Focus on Click

6 posts, 0 answers
  1. MiddleTommy
    MiddleTommy avatar
    163 posts
    Member since:
    Nov 2009

    Posted 13 May 2011 Link to this post

    Something has changed in a recent nightly update with what I have decided is the RadMenu / RadMenuItem.
    I believe when a user clicked on a menuitem in previous versions that the menu or item got focus.
    This would commit any edits you were doing in textboxes or gridviews.
    Now when you click a menuItem the grid or textbox keeps focus and does not update the source on any databindings.
    I can see how you would not want to loose focus on say a "Copy" menu item.
    But you do want to loose focus on a "Save" menu item.

    I am currently having to go through my app an make sure all Databindings are updated when a menuitem such as "Save" is clicked.
    My users started reporting behavior of "I swear I entered that info before I saved it"

    What can be done to solve both scenarios of menuitem click and focus behavior?
    I am using the latest dev version 2011.1.419.1040
  2. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 16 May 2011 Link to this post

    Hello Tommy,

    We did some changes/improvements in RadMenuItem related to ICommand and IsEnabled but we still Focus MenuItems because otherwise there will be no keyboard navigation.

    Could you send us sample project where we can reproduce this behavior?

    Regards,
    Hristo
    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. MiddleTommy
    MiddleTommy avatar
    163 posts
    Member since:
    Nov 2009

    Posted 30 Aug 2011 Link to this post

    I think the RadGridView Changed I now have to explicitly set 
    ActionOnLostFocus="CommitEdit"
    in the RadGridView xaml definition.
  5. Jens Hobbie
    Jens Hobbie avatar
    15 posts
    Member since:
    Mar 2010

    Posted 21 Oct 2011 Link to this post

    Hello,
    This problem occurs in our application also.
    We have a RadGridView and a RadToolbar. Grid has ActionOnLostFocus="CommitEdit" set.
    But when grid row is in edit and if we are editing a custom column, CommitEdit is not performed on lost focus. (Custom column has an RadDropDownButton (with custom form as content) as a cellEditElement.) Grid just closes the dropdown button but for some does not pefrom CommitEdit after that...
    This is a problem because contented entered in form (contained in dropdown button) is not committed to changes to object (if for example user clicked save button in toolbar it will not be saved).
    So you maybe have an idea what is wrong? Any advice/tip would be helpful.

  6. MiddleTommy
    MiddleTommy avatar
    163 posts
    Member since:
    Nov 2009

    Posted 21 Oct 2011 Link to this post

    I think it is a problem in Silverlight in general. The Lost Focus event is triggered after the button click event. I believe the latest version of Telerik Silverlight RadControls fixed this issue.

    But if not, I have found that setting focus to the menu when mouseenter will solve this problem.
    The grid looses focus properly and commits the edit.

           
    private void RadMenu_MouseEnter(object sender, MouseEventArgs e)
    {
        var m = sender as RadMenu;
        if (m != null)
            m.Focus();
    }


  7. Jens Hobbie
    Jens Hobbie avatar
    15 posts
    Member since:
    Mar 2010

    Posted 27 Oct 2011 Link to this post

    Hello MiddleTommy,

    Thank you on your suggestion, but unfortunately this did not help in our specific problem.
    RadDropDown button was still not closed and CommitEdit action was not performed.

    Finally we solved it by adding a bit of a hack code to GetNewValueFromEditor methods in our custom column class:
    //close dropdown button
    (editor as RadDropDownButton).IsOpen = false;
     
    //focus parent grid of control
    RadGridView parentGrid = (editor as RadDropDownButton).ParentOfType<RadGridView>();
    parentGrid.Focus();
    We force RadDropDown button to close and return focus to parent RadGridView.
    And now CommitEdit action will be performed when user clicks button in menu...

    I know it is not very elegant, but it worked. :)
Back to Top
DevCraft banner