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

Disable Conditional formatting

I've looked at the documentation for the GridDataControl and I've not seen any examples where the conditional formatting can be turned off or on.

I have a GridDataControl with records that are colored differently based on the values in a column. I want to put a checkbox outside the grid that can control whether or not the coloring is applied at all. Unfortunately the GridDataConditionalFormat does not have an "IsEnabled" property that I could bind to my checkbox. Another idea I had was adding a second GridDataCondition to the GridDataConditionalFormat and using a predicate "AND" but it seems like I have to specify a ColumnName for the GridDataCondition and cannot use the checkbox's value in this second GridDataCondition.

Does anyone know of a way to toggle the conditional formatting or use a property external to the GDC in a GridDataCondition?

Any help is appreciated.

Thanks.

James

1 Reply

SM Saravanan M Syncfusion Team January 14, 2015 01:53 PM UTC


Hi James,

Thanks for contacting Syncfusion support,

We have analyzed your query. You could not Enable or Disable the GridDataConditionalFormat by using IsEnable property because since this property not available in GridDataConditionalFormat . But you can achieve your requirement like binding the CheckBox by interaction behavior with custom Dependency Property. Here we have bind the custom dependency property to IsChecked property of CheckBox. We have applied the conditional formatting to GridDataControl based on checkbox value in DependencyPropertyChangedCallBack method. Please refer the below code snippet.

Code snippet[XAML]:

<i:Interaction.Behaviors>

    <local:BehaviorClass Enable="{Binding Path=IsChecked, ElementName=checkbox}" />

</i:Interaction.Behaviors>

We have prepared a sample based on this and, you can download it from below location.

Sample Location: GridDataControl_ConditionalFormat.zip

Please let us know if you have any other queries,

Regards,

Saravanan.M



Loader.
Live Chat Icon For mobile
Up arrow icon