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

Keyboard Response & MVVM

5 Answers 86 Views
Window
This is a migrated thread and some comments may be shown as answers.
Terry Foster
Top achievements
Rank 1
Terry Foster asked on 09 Feb 2011, 04:29 AM
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

5 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 15 Feb 2011, 09:44 AM
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>>
0
Terry Foster
Top achievements
Rank 1
answered on 17 Feb 2011, 04:00 PM
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
0
ss
Top achievements
Rank 1
answered on 05 Jul 2011, 10:29 AM
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.
0
George
Telerik team
answered on 11 Jul 2011, 09:12 AM
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!

0
ss
Top achievements
Rank 1
answered on 11 Jul 2011, 12:40 PM
Thanks.its working fine
Tags
Window
Asked by
Terry Foster
Top achievements
Rank 1
Answers by
George
Telerik team
Terry Foster
Top achievements
Rank 1
ss
Top achievements
Rank 1
Share this question
or