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

changing the foreground on entire grid entry by value

I am trying to change the cell color based on a single value not based on that cell.  I have a list of calendar events some are active and some are not, if the event is inactive I want the cell to show the event description in red, otherwise in black.  This needs to be either in the xaml or using a MVVM, code behind is not an option.  I have looked and I only see ways to change it based on the cell itself not another cell.

 


1 Reply

RS Ravi Shankar B Syncfusion Team November 28, 2012 08:51 AM UTC

Hi Matthew,

 

We have analyzed your query and you can achieve it throw XAML level in sample. For your requirement you can set conditional formatting as code suggested follows.

 

XAML code snippet:

<syncfusion:GridDataControl.ConditionalFormats>

                <syncfusion:GridDataConditionalFormat Name="Condition" ApplyStyleToColumn="Description">

                    <syncfusion:GridDataConditionalFormat.Style>

                        <syncfusion:GridDataStyleInfo Foreground="Red" />

                    </syncfusion:GridDataConditionalFormat.Style>

                    <syncfusion:GridDataConditionalFormat.Conditions>

                        <syncfusion:GridDataCondition ColumnName="Date"

                                                      ConditionType="Equals"

                                                      PredicateType="Or"

                                                      Value="{Binding Today}" />

                        <syncfusion:GridDataCondition ColumnName="Date"

                                                      ConditionType="GreaterThan"

                                                      PredicateType="Or"

                                                      Value="{Binding Today}" />

                    </syncfusion:GridDataConditionalFormat.Conditions>

                </syncfusion:GridDataConditionalFormat>

            </syncfusion:GridDataControl.ConditionalFormats>

 

 

We have created a simple sample for this and you can download it from the following link.

http://www.syncfusion.com/downloads/Support/DirectTrac/101303/GDC_DateDescription1263098285.zip

 

Regards,

Ravi Shankar B.


Loader.
Live Chat Icon For mobile
Up arrow icon