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

How Can I Disable ALL the KeyBoard Action

4 Answers 143 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Peter Zhao
Top achievements
Rank 1
Peter Zhao asked on 30 Jun 2011, 10:37 PM
I am Using the telerik treeview control in our silverlight application. For this application, we are using the tree to display a tree structure graph, this application only allow the user interact by using Mouse click, we find the control has space key available and these arrow key available to interact the application, how can we disable all the Key board interaction but only mouse available?

Thanks,
Peter

4 Answers, 1 is accepted

Sort by
0
Peter Zhao
Top achievements
Rank 1
answered on 06 Jul 2011, 04:48 AM
Is there anyone can help please? I am waiting for the answer.
0
Petar Mladenov
Telerik team
answered on 06 Jul 2011, 12:00 PM
Hello Peter Zhao,

You can use the PreviewKeyDown event of the RadTreeView like so:
private void radTreeView_PreviewKeyDown(object sender, KeyEventArgs e)
      {
          e.Handled = true;
      }
Let us know if this satisfies you.

All the best,
Petar Mladenov
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
Peter Zhao
Top achievements
Rank 1
answered on 06 Jul 2011, 10:21 PM
Hi Petar Mladenov :

I use the Telerik Control 2011Q1 but I couldn't find the PreviewKeyDown Event for the RadTreeView. : (
 Is there anything I need to check?


Regards,
Peter Zhao
0
Petar Mladenov
Telerik team
answered on 07 Jul 2011, 02:46 PM
Hi Peter Zhao,

Please first excuse me for misleading you with a WPF solution instead of SL`s one.
In Silverlight , you can inherit RadTreeView and RadTreeViewItem and override their OnKeyDown and OnKeyUp protected methods like so:
public class CustomTreeView :RadTreeView
    {
        protected override void OnKeyDown(KeyEventArgs e)
        {
             
        }
 
        protected override void OnKeyUp(KeyEventArgs e)
        {
 
        }
    }
The key thing here is that you don't make call to base.OnkeyDown(e); and base.OnkeyUp(e).
The described approach is realized in the attachment. So please give it a try and let us know if it helps you.
Best wishes,
Petar Mladenov
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!

Tags
TreeView
Asked by
Peter Zhao
Top achievements
Rank 1
Answers by
Peter Zhao
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or