Set Add New Row Color

2 posts, 0 answers
  1. Paul
    Paul avatar
    35 posts
    Member since:
    Jan 2014

    Posted 25 Dec 2014 Link to this post

    Hi,

    I am using Themes for my application.  I would like to color the the Add New Row Back Color style.  I am wondering what the best way to do this is.

    I have all "Default" styles selectable from a drop down in the main screen.

    Is it best to use the App Style Builder for this?  I don't have much experience using it and just wondering the effort needed - ie:

    How does the application pick up the modified default themes?  Do I export/save to a file?

    If I did this in code, I guess if I styled it blue and the theme was the Telerik Metro with the green feel then this would look out of place.

    Thanks for any tips and info

    Andez
  2. Dimitar
    Admin
    Dimitar avatar
    2686 posts

    Posted 26 Dec 2014 Link to this post

    Hi Andez,

    Thank you for writing.

    It seems easier to do this in code because if you use Visual Style Builder you should extract all predefined themes and change the style in each one of them. Then you can use the new themes in your application. Nevertheless the following articles are describing how you can work with VSB.
    The attached image shows how you can change the BackColor in the themes.

    In code this can be done by using the ViewRowFormatting event. You can change the color depending on the current theme:
    void radGridView1_ViewRowFormatting(object sender, RowFormattingEventArgs e)
    {
        if (e.RowElement is GridNewRowElement)
        {
            if (ThemeResolutionService.ApplicationThemeName == "TelerikMetro")
            {
                e.RowElement.BackColor = Color.Red;
            }
            else if (ThemeResolutionService.ApplicationThemeName == "TelerikMetroBlue")
            {
                e.RowElement.BackColor = Color.Orange;
            }
            else
            {
                e.RowElement.BackColor = Color.DarkGray;
            }
        }
        else
        {
            e.RowElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
        }
    }

    I hope this will be useful. Should you have further questions, I would be glad to help.
     
    Regards,
    Dimitar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top