Row indicator with selectionmode=cell

3 posts, 0 answers
  1. Gopala
    Gopala avatar
    28 posts
    Member since:
    Jul 2012

    Posted 26 Jun 2012 Link to this post


    We are using Q2 2010 telerik controls. We want to use Row indicator with SelectionUnit = Cell for RadGridView.

    When user clicks on Row Indicator column the entire row must be selected but when user clicks a cell inside RadGridView only that cell must be selected but for me it is selecting entire row.

    I also noticed that for row indicator functionality, I must give SelectionUnit = FullRow , but we want SelectionUnit =Cell.

    Please see below code for what I am doing

    <telerik:RadGridView     x:Name="gridCusip"
                             ItemsSource="{Binding Nodes}"

    I also tried below code

    this.gridCusip.CurrentCellChanged += new EventHandler<GridViewCurrentCellChangedEventArgs>(gridCusip_CurrentCellChanged);

     void gridCusip_CurrentCellChanged(object sender, GridViewCurrentCellChangedEventArgs e)
          this.gridCusip.CurrentItem = e.NewCell.DataContext;

    Please advice me how to solve this.

    Thanks in advance.
  2. Gopala
    Gopala avatar
    28 posts
    Member since:
    Jul 2012

    Posted 29 Jun 2012 Link to this post

    I donot understand why but I never get any help or responses to my queries here.

    I fixed this issue as below

    In constructor
    this.AddHandler(RadGridView.MouseLeftButtonDownEvent, new MouseButtonEventHandler(gridCusip_MouseLeftButtonDown), true);

    void gridCusip_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
          if (this.gridCusip.SelectionUnit != GridViewSelectionUnit.Cell)
            var element = e.OriginalSource as FrameworkElement;
            var cell = element.ParentOfType<GridViewCell>();
            if (cell != null)
              this.gridCusip.SelectionUnit = GridViewSelectionUnit.Cell;
              var cellInfo = new GridViewCellInfo(cell);
     private void gridCusip_RowLoaded(object sender, RowLoadedEventArgs e)
          GridViewRow row = e.Row as GridViewRow;
          if (row != null)
            Border indicatorPresenter = row.ChildrenOfType<Border>().Where(b => b.Name == "PART_IndicatorPresenter").FirstOrDefault();
            indicatorPresenter.MouseLeftButtonDown += new MouseButtonEventHandler(indicatorPresenter_MouseLeftButtonDown);
        private void indicatorPresenter_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
          if (this.gridCusip.SelectionUnit != GridViewSelectionUnit.FullRow)
            var border = sender as Border;
            var row = border.ParentOfType<GridViewRow>();
            this.gridCusip.SelectionUnit = GridViewSelectionUnit.FullRow;
            this.gridCusip.SelectedItem = row.Item;
  3. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 15 Feb 2013 Link to this post


    I am writing with an update that we have introduced such feature out-of-the-box with our official Q3 2012 SP1 release. All you need to do is set SelectionUnit property of the grid to be "Mixed".  

    I hope this helps.

    All the best,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top