Keyboard Response & MVVM

6 posts, 0 answers
  1. Terry Foster
    Terry Foster avatar
    60 posts
    Member since:
    Sep 2009

    Posted 08 Feb 2011 Link to this post

    I have a couple of related questions:

    First, according to the documention, I see that one can use the 'RadWindow.ResponseButton' attached property to associate a button with the 'Enter' or 'Escape' key presses.  However, it only mentions that the button's Click event is invoked when the key is pressed.  I'm not seeing any mention of the bound 'Button.Command' being executed, which is what is needed in an MVVM scenario.  And, indeed, it doesn't seem to work when I try it.  Is there some way I can get this to work?  If not, are there plans?

    Second, I actually already implemented a framework where, in XAML, I can tag any control with the button that is associated with the 'Enter' and 'Escape' keys.  This framework relies on handling the 'UIElement.KeyDown' event and it works great for pretty much any kind of FrameworkElement container - Grid, StackPanel, ChildWindow, etc.  However, it doesn't work with the RadWindow, apparently because it seems to be suppressing the KeyDown event - at least, it never seems to be getting raised.  Do you have any idea why this would be the case and if there is some way to not suppress this event?

    Thanks,
    Terry Foster
  2. George
    Admin
    George avatar
    1332 posts

    Posted 15 Feb 2011 Link to this post

    Hello Terry, 


    Straight to your questions:

    1. I would suggest you to use the RadButton control, because in the Button control there is a bug. Attached you can find the sample. Please, look at it and let me know if this helps.
    2. Could you please give us more detailed information about your scenario? If you send us a sample project that reproduces the problem it would be very helpful. I am glad to assist you further.


    All the best,
    George
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft banner
  4. Terry Foster
    Terry Foster avatar
    60 posts
    Member since:
    Sep 2009

    Posted 17 Feb 2011 Link to this post

    It turns out that the RadWindow is raising the KeyDown event just fine, but it didn't appear to be because of the focus issue discussed in my other thread: http://www.telerik.com/community/forums/silverlight/window/major-focus-tabbing-issue-with-showdialog.aspx.  My keyboard response framework works just fine when the RadWindow properly gets focus.

    Thanks,
    Terry
  5. ss
    ss avatar
    37 posts
    Member since:
    Nov 2010

    Posted 05 Jul 2011 Link to this post

    hi

    i am using radwindow as a commoncontrols for all screens through one class
    class: Radwindow.

    my doubt is i wnat listen the two keys in
    this.keydown evet

    the two keys are ctrl + w keys.

    i cna able to listen only the last pased key.

    i above cas ei cna listen only W.
    please help me on aboce scanrio.

    advance thanks.
  6. George
    Admin
    George avatar
    1332 posts

    Posted 11 Jul 2011 Link to this post

    Hello,

    I would suggest using the Keyboard.Modifiers static property to get whether the Control key is pressed or not:

    private void UserControl_KeyDown(object sender, KeyEventArgs e)
            {
                if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.W)
                {
                }
            }


    I hope this helps.

     

    Regards,
    George
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  7. ss
    ss avatar
    37 posts
    Member since:
    Nov 2010

    Posted 11 Jul 2011 Link to this post

    Thanks.its working fine
Back to Top
DevCraft banner