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

Menu Focus on Click

5 Answers 70 Views
Menu
This is a migrated thread and some comments may be shown as answers.
MiddleTommy
Top achievements
Rank 1
MiddleTommy asked on 13 May 2011, 04:19 PM
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

5 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 16 May 2011, 08:56 AM
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
0
MiddleTommy
Top achievements
Rank 1
answered on 30 Aug 2011, 03:02 PM
I think the RadGridView Changed I now have to explicitly set 
ActionOnLostFocus="CommitEdit"
in the RadGridView xaml definition.
0
Jens Hobbie
Top achievements
Rank 1
answered on 21 Oct 2011, 01:46 PM
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.

0
MiddleTommy
Top achievements
Rank 1
answered on 21 Oct 2011, 04:26 PM
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();
}


0
Jens Hobbie
Top achievements
Rank 1
answered on 27 Oct 2011, 02:31 PM
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. :)
Tags
Menu
Asked by
MiddleTommy
Top achievements
Rank 1
Answers by
Hristo
Telerik team
MiddleTommy
Top achievements
Rank 1
Jens Hobbie
Top achievements
Rank 1
Share this question
or