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

Ctrl + Shift + C keyDown event don't work when focus cursor into RadGridView

5 Answers 188 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Umbala
Top achievements
Rank 1
Umbala asked on 04 Mar 2011, 08:21 AM
Hi telerik team!
Ctrl + Shift + C  keyDown event don't work when focus cursor into RadGridView.  Orther Keydown event work fine except (Ctrl + Shift + C)
Thanks!

5 Answers, 1 is accepted

Sort by
0
Umbala
Top achievements
Rank 1
answered on 09 Mar 2011, 02:20 AM
Please help me!
0
Milan
Telerik team
answered on 09 Mar 2011, 07:30 AM

Hi Umbala,

Could you please provide more information about this problem? What is the expected behavior when Control +Shift + C buttons are pressed?



Regards,
Milan
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Umbala
Top achievements
Rank 1
answered on 11 Mar 2011, 08:20 AM
I cretate a new child window and put a RadGridView on it. I handler Keydown event to close from but Ctrl + Shift + C don't work

Code behind :

Private Sub Window_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Input.KeyEventArgs) Handles Me.KeyDown 
    RouteKeyDown(sender, e) 
End Sub 
Private Sub RouteKeyDown(ByVal sender As Object, ByVal e As System.Windows.Input.KeyEventArgs) 
    Dim keys As ModifierKeys = Keyboard.Modifiers 
    Dim shiftKey As Boolean = (keys And ModifierKeys.Shift) <> 0 
    Dim altKey As Boolean = (keys And ModifierKeys.Alt) <> 0 
    Dim controlKey As Boolean = (keys And ModifierKeys.Control) <> 0 
    'Ctrl + Shift + C  
    If e.Key = Key.C And controlKey = True And shiftKey = True Then             ' don't work
        Me.Close() 
    End If 
    If e.Key = Key.U And controlKey = True And shiftKey = True Then              ' work fine          
        Me.Close() 
    End If 
End Sub
0
Milan
Telerik team
answered on 11 Mar 2011, 08:51 AM

Hi Umbala,

RadGridView will handle events for keys like Control, Shift, etc and those events will not reach the window. You can workaround this by subscribing to those event in code using the AddHandler method and suppling true as last argument. For example:

Imports System
Imports System.Linq
Imports System.Windows.Controls
Imports System.Collections.ObjectModel
Imports System.Windows.Data
Imports Telerik.Windows.Controls
Imports System.Windows
Imports System.Windows.Input
  
Namespace SilverlightApplication1
    Public Partial Class MainPage
        Inherits UserControl
        Public Sub New()
  
            Me.[AddHandler](FrameworkElement.KeyDownEvent, New KeyEventHandler(OnKeyDown), True)
        End Sub
  
        Private Sub OnKeyDown(sender As Object, e As KeyEventArgs)
            ' TODO: Implement this method
            Throw New NotImplementedException()
        End Sub
    End Class
End Namespace



Regards,
Milan
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Umbala
Top achievements
Rank 1
answered on 11 Mar 2011, 09:48 AM
Work fine. Thanks!
Tags
GridView
Asked by
Umbala
Top achievements
Rank 1
Answers by
Umbala
Top achievements
Rank 1
Milan
Telerik team
Share this question
or