SelectionUnit and CanUserDeleteRows

2 posts, 0 answers
  1. Greg
    Greg avatar
    7 posts
    Member since:
    Sep 2010

    Posted 07 Jan 2011 Link to this post

    Is there a way to have the SelectionUnit=Cell and the CanUserDeleteRows still enabled?  It appears that the command enabling checks to see what the selection unit is and whether the user can delete rows.

    I am going to override the Deleting event and will handle the deleting myself, I am just looking for the delete key event that excludes it happening in a cell.

  2. Maya
    Maya avatar
    4062 posts

    Posted 10 Jan 2011 Link to this post

    Hello Greg,

    This behavior is by design - once you set SelectionUnit to "Cell" the deleting functionality is disabled. However, what you can do is to handle the PreviewKeyDownEvent and implement your custom logic when the pressed key is Del:

    this.RadTreeListView1.AddHandler(RadTreeListView.PreviewKeyDownEvent, new KeyEventHandler(OnKeyDown),true);    
    private void OnKeyDown(object sender, KeyEventArgs e)
        if(e.Key == Key.Delete)
            MessageBox.Show("You are deleting!");


    Best wishes,
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top