overrinding theme to change the hottracking's color

3 posts, 0 answers
  1. QuizzBox
    QuizzBox avatar
    93 posts
    Member since:
    Jan 2011

    Posted 10 Mar 2017 Link to this post

    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. Hristo
    Admin
    Hristo avatar
    1522 posts

    Posted 14 Mar 2017 Link to this post

    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.
  3. QuizzBox
    QuizzBox avatar
    93 posts
    Member since:
    Jan 2011

    Posted 14 Mar 2017 in reply to Hristo Link to this post

    it works out fine

    thans

Back to Top