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

Set Add New Row Color

1 Answer 33 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 25 Dec 2014, 08:49 PM
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
‚Äč

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 26 Dec 2014, 07:37 AM
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.

 
Tags
GridView
Asked by
Paul
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or