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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Style and binding

Thread ID:





97068 Oct 25,2010 01:13 PM UTC Dec 21,2010 03:32 PM UTC WPF 3
Tags: GridControl
Administrator [Syncfusion]
Asked On October 25, 2010 01:13 PM UTC


I want to be able to change styling based on bound values. More specific: If I have a row that contain a value from 1 to 100, how do I bind the backgroundcolor of that row such that a value of 1 gives green and the color moves more and more to the red as the value goes to 100 ?



S. Sridharan [Syncfusion]
Replied On November 21, 2010 11:17 AM UTC

Hi Morten,

Thanks for using Syncfusion Product.

If you want to set the background colour based on the bound value in XAML, you can use the conditional formatting in which you can set the style for the cells of a particular column based on bound value. You can also apply the background as you requested, in code behind in Model.QueryCellInfo
event handler.
Please find a sample on this in the following location.


For conditional formatting, already there is an example in our Dash board for this. Please refer the sample in the location.

Sample : $Installation directory\EssentialStudio\\WPF\Grid.WPF\Samples\3.5\WindowsSamples\Grid Data Control - Advanced\Conditional Formatting Demo\CS

Sridharan S.

John Fairbanks
Replied On November 23, 2010 05:23 PM UTC

The problem with the conditional formatting is that you cannot control the style through binding.... for example, you allow me to set the color of a grid cell to "red" if the cell's value is > 100... but I have no way to bind the background color to something. In my case I have a Color property in my row object and I want to bind the Background color to it. The way y'all are doing ti forces me to hard code my business logic inside the XAML unless I want to punt and do things in code behind.

Mohamed Suhaib Fahad A. [Syncfusion]
Replied On December 21, 2010 03:32 PM UTC

Hi John,

We understand your requirements. Right now the grid is implemented with an optimized Style architecture that is different from WPF architecture, this was done because of several performance reasons and that's why we don't have direct manipulation of WPF Style objects. You can create a DirectTrac incident for follow-up, We will take this as a feedback and process it in our future releases.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon