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

RadMenu Focus Issue

3 Answers 84 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Kyle
Top achievements
Rank 1
Kyle asked on 02 Jun 2011, 08:26 PM
I've found other posts about this but none seemed to fully address how to fix the problem so I apologize if this has been answered elsewhere.

The problem I'm having is that when a user clicks on a menu item with no children, like "Save", the PropertyChangedEventHandler isn't being fired if the user was typing into a textbox prior to it (presumably because focus isn't being changed).  This leads to the text entered immediatedly before the "Save" click to be lost as the textbox never updates the code.

Oddly enough, it does seem to switch focus if the user pans the mouse over a menu item that does have children, making the drop down boxes appear.  So my question is this:  Is there any way to alter the single menu item when using view/view models to mimic the focus change that the displaying of the children seems to do?

Sorry if I'm not the clearest either, but just started working on stuff like this two days ago so I'm no expert.  Thanks in advance for any answers.

3 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 03 Jun 2011, 11:13 AM
Hello Kyle,

Two options comes to my mind:
1. Add handler to RadMenu ItemClick event and call focus on RadMenu. This way you will force TextBox to lose focus and update its binding.
2. Add handler to RadMenu ItemClick event and get the TextBox the take the binding and manually call Update on the binding. You can take the Binding using GetBindingExpression(TextBox.TextProperty) then ParentBinding.

I hope that this will help you.

Greetings,
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
Kyle
Top achievements
Rank 1
answered on 03 Jun 2011, 06:35 PM
Thanks a lot for the reply.

Ironically I had tried your option #2 but couldn't get it to work, mostly because the page had contents controls to display other pages.  (Don't know the correct XAML term for them, called them "frames" when I did HTML).  For some reason, the first option didn't seem to work either.  Couldn't figure out why though I'm afraid.

Instead we decided to simply put the save button inside a drop down like the other menu items so that when the drop down effect occured, the textbox would update properly.

Thanks again for the help though!
0
Hristo
Telerik team
answered on 06 Jun 2011, 08:07 AM
Hi Kyle,

I've attached sample project demonstrating the second approach.

Let me know if this helps you.

Greetings,
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
Tags
Menu
Asked by
Kyle
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Kyle
Top achievements
Rank 1
Share this question
or