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

Highlight GridViewRow when GridViewCell is selected

1 Answer 206 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 11 Oct 2010, 02:06 PM

I have the RadGridView setup with

SelectionUnit="Cell"  
SelectionMode="Extended"

Is there any way to highlight the current row (obviously in some color that is not the same as the cell highlight) when I have selected a cell in it?  I was able to make a style that changed the row color when the mouse was over it, but that's not really what I need.

Basically I want it to work like SQL Management Studio does when you click the row number.. it selects the row... but as far as I can tell there is no way to mix the selection mode.

1 Answer, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 11 Oct 2010, 04:13 PM
Hi Jason,

You may take a look at this forum thread for a reference, demonstrating how to select a row when clicking on the row-header, while the selection unit is set to "cell".
Otherwise, you may handle the SelectedCellChanged and find the corresponding row like follows:

private void clubsGrid_SelectedCellsChanged(object sender, GridViewSelectedCellsChangedEventArgs e)
{          
    foreach (GridViewCellInfo cell in e.AddedCells)
    {
        GridViewRow row = this.clubsGrid.ItemContainerGenerator.ContainerFromItem(cell.Item) as GridViewRow;
        row.Background = new SolidColorBrush(Colors.Green);
    }
}

However, I am not exactly sure whether this will serve your needs.
 

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
Tags
GridView
Asked by
Jason
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or