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

overrinding theme to change the hottracking's color

2 Answers 157 Views
GridView
This is a migrated thread and some comments may be shown as answers.
OD
Top achievements
Rank 1
OD asked on 10 Mar 2017, 09:13 AM

Hi,

i would like to override the hottracking's color of my rows in runtime.

Can i use the SetThemeValueOverride method and how to do this ?

thanks

 

2 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 14 Mar 2017, 12:29 PM
Hello QuizzBox,

Thank you for writing.

You can handle the CellFormatting event of the grid and modify the HotTracking element state. Please note that if you need to apply the custom styles based on some conditions you will also need to reset them because of the virtualization: 
private void radGridView1_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
    if (!e.Row.IsSelected && e.Row is GridViewDataRowInfo)
    {
        e.CellElement.SetThemeValueOverride(LightVisualElement.BackColorProperty, Color.LightGreen, "GridDataCellElement.HotTracking");
        e.CellElement.SetThemeValueOverride(LightVisualElement.BackColorProperty, Color.LightGreen, "GridDateTimeCellElement.HotTracking");
        e.CellElement.SetThemeValueOverride(LightVisualElement.BackColorProperty, Color.LightGreen, "GridCheckBoxCellElement.HotTracking");
    }
    else
    {
        e.CellElement.ResetThemeValueOverride(LightVisualElement.BackColorProperty, "GridDataCellElement.HotTracking");
        e.CellElement.ResetThemeValueOverride(LightVisualElement.BackColorProperty, "GridDateTimeCellElement.HotTracking");
        e.CellElement.ResetThemeValueOverride(LightVisualElement.BackColorProperty, "GridCheckBoxCellElement.HotTracking");
    }
}

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
OD
Top achievements
Rank 1
answered on 14 Mar 2017, 01:51 PM

it works out fine

thans

Tags
GridView
Asked by
OD
Top achievements
Rank 1
Answers by
Hristo
Telerik team
OD
Top achievements
Rank 1
Share this question
or