Selected Cell

4 posts, 0 answers
  1. Daní
    Daní avatar
    303 posts
    Member since:
    Feb 2008

    Posted 04 Nov 2010 Link to this post

    Hello,

    Is there any way to get the SelectedCell in a GridView o TreeListView? I 'd like to bind the GridView "SelectedCell" to a ViewModel property.

    Thanks...
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 04 Nov 2010 Link to this post

    Hi Daní,

    RadGridView provides a CurrentCell property. Additionally, a collection of all selected cells - SelectedCells is also available.
    Let me know if you need any further assistance.
     

    Sincerely yours,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Christian
    Christian avatar
    4 posts
    Member since:
    Jun 2010

    Posted 04 Nov 2010 Link to this post

    On the same subject, I need to know that specific cell (rowid, colid) was selected when you double click on the grid, thanks.
    We do know how the double click event.
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 05 Nov 2010 Link to this post

    Hello Christian,

    Following the example for cell double-clicking, you may get the corresponding column as:

    private void OnCellDoubleClick(object sender, RadRoutedEventArgs args)
            {
                GridViewCellBase cell = args.OriginalSource as GridViewCellBase;
                if (cell != null)
                {
                    this.ClickedCell = cell;
                    var correspondingColumn = cell.Column;
                }
    }
     
    Considering the getting the row, you find it with the help of the extension method ParentOfType<>:
    var correspondingRow = cell.ParentOfType<GridViewRow>();

    The row index may be taken with the ItemContainerGenerator:
    var rowIndex = this.playersGrid.ItemContainerGenerator.IndexFromContainer(correspondingRow);


    Regards,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top