How Can I Disable ALL the KeyBoard Action

5 posts, 0 answers
  1. Peter Zhao
    Peter Zhao avatar
    10 posts
    Member since:
    May 2010

    Posted 30 Jun 2011 Link to this post

    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
  2. Peter Zhao
    Peter Zhao avatar
    10 posts
    Member since:
    May 2010

    Posted 05 Jul 2011 Link to this post

    Is there anyone can help please? I am waiting for the answer.
  3. DevCraft banner
  4. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 06 Jul 2011 Link to this post

    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!

  5. Peter Zhao
    Peter Zhao avatar
    10 posts
    Member since:
    May 2010

    Posted 06 Jul 2011 Link to this post

    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
  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 07 Jul 2011 Link to this post

    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!

Back to Top
DevCraft banner