RadMenu Focus Issue

4 posts, 0 answers
  1. Kyle
    Kyle avatar
    7 posts
    Member since:
    Jun 2011

    Posted 02 Jun 2011 Link to this post

    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.
  2. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 03 Jun 2011 Link to this post

    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
  3. DevCraft banner
  4. Kyle
    Kyle avatar
    7 posts
    Member since:
    Jun 2011

    Posted 03 Jun 2011 Link to this post

    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!
  5. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 06 Jun 2011 Link to this post

    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
Back to Top