We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Is there anyway I can change entire row text color to red?

Hi,
I am wondering if there is anyway I can change an entire row forecolor? I know there are cell template selectors but that only works for single cell, I like to change forecolor for entire row. 

Thanks,
Vasanth

3 Replies

JN Jayaleshwari N Syncfusion Team May 19, 2015 10:00 AM UTC


Hi Vasanth,

Thank you for using Syncfusion Products.

We are unable to understand your query clearly and we require more information on this. Based on your update “can change an entire row forecolor”, we assume that you would like to change the foreground color of the row and it can be changed under following circumstances :

1.    You can apply foreground color to particular row based on row index using RowStyle selector.

2.    Selected row foreground can be changed based on selection border visibility using RowStyle and CellStyle.

We have prepared a sample with above cases. You can download the sample from the following location:

Sample: RowForeground.zip

Please refer the following UG link to know about the styling support of SfDataGrid:

Styling Rows - UG: http://help.syncfusion.com/UG/winrt/index.html#!Documents/stylingrows.htm

Style Selectors - UG: http://help.syncfusion.com/UG/winrt/index.html#!Documents/styleselectors.htm

Please refer the following KB to style the selected row or cell:

KB: http://www.syncfusion.com/kb/2542/how-to-change-background-and-foreground-for-selected-row-or-cell

Please let us know if this solution helps.

Regards,

Jayaleshwari N.




VA Vasanth May 19, 2015 06:05 PM UTC

Hi Jayaleshwari,
Thanks for your input. I am able to use the RowStyleSelector option to set Foreground color based on some criteria. Its working fine except for CellTemplate column. I am attaching a sample  app created to demonstrate the issue.

Run the app, and you can see that Rows with ID: 1001 will have a Red foreground expect for Name column. Name column is a GridTemplateColumn with a button. Please let me know how can I make the Name color derive same style as its row.

Thanks,
Vasanth

Attachment: SfDataGridWithStackedHeaders_fbfbc766.zip


JN Jayaleshwari N Syncfusion Team May 20, 2015 04:11 PM UTC

Hi Vasanth,

We have analyzed your requirement “Row Style Selector not working for template column”.  It’s the default behavior that the control loaded within the DataTemplate won’t receive the foreground property value from its parent. So, we  suggest you to use CellStyle Selector and Converter for Foreground property of TextBlcok to achieve your requirement.

We have modified the sample as per your requirement. You can download sample from the following location.

Sample: SfDataGridWithStackedHeaders.zip

Please let us know, if this solution helps.

Regards,

Jayaleshwari N.



Loader.
Live Chat Icon For mobile
Up arrow icon