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
close icon

GridDataConditionalFormat in code

I want to set the conditional formats in code. I would think this works:

GridDataConditionalFormat format1 = new GridDataConditionalFormat();
format1.Name = "format1";

GridDataStyleInfo styleInfo = new GridDataStyleInfo();
styleInfo.Background = Brushes.Red;
format1.Style = styleInfo;
format1.ApplyStyleToColumn = "Volume";

GridDataCondition condition1 = new GridDataCondition();
condition1.ColumnName = "Volume";
condition1.ConditionType = GridDataConditionType.GreaterThan;
condition1.PredicateType = Syncfusion.Windows.Data.PredicateType.Or;
condition1.Value = 500;
format1.Conditions.Add(condition1);
grid.ConditionalFormats.Add(format1);

but I get an:

{"Object reference not set to an instance of an object."} error.

I am binding to a dataset and don't set any conditions in xaml. What I am doing wrong?


1 Reply

BK Balaji K Syncfusion Team October 11, 2010 05:39 AM UTC

Hi Bill,

Thanks for your patience.

We are afraid that we are unable to reproduce the issue mentioned. Please revert us the modifying the attached sample and steps to reproduce the same.

Regards,
Balaji.



DataBind_DataTable_ConditionalFromat_5d5e80b4.zip

Loader.
Live Chat Icon For mobile
Up arrow icon