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

Selected Cell

3 Answers 119 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Daní
Top achievements
Rank 1
Daní asked on 04 Nov 2010, 05:41 PM
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...

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 04 Nov 2010, 05:44 PM
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
0
Cris
Top achievements
Rank 1
answered on 04 Nov 2010, 06:49 PM
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.
0
Maya
Telerik team
answered on 05 Nov 2010, 09:02 AM
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
Tags
GridView
Asked by
Daní
Top achievements
Rank 1
Answers by
Maya
Telerik team
Cris
Top achievements
Rank 1
Share this question
or