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

Change Column Cells background based on value

Thread ID:

Created:

Updated:

Platform:

Replies:

141478 Dec 13,2018 12:27 PM UTC Dec 14,2018 10:16 AM UTC WPF 1
loading
Tags: SfDataGrid
Sascha Bauer
Asked On December 13, 2018 12:27 PM UTC

Dear admin,

im trying a lot with your datagrid but dont find a solution for changing the backgroundcolor of cells, which are part of one specific column. F.e. they should change to green if process is completed else they should be red. The values of the columns get loaded by database. Datagrid already takes cellstyle and the cellstyle should only affect background property to the cells in the specific column. Hope you can help me further and my project is in MVVM style.

Regards.

Jayaleshwari N [Syncfusion]
Replied On December 14, 2018 10:16 AM UTC

Hi Sascha, 
 
Thanks for contacting Syncfusion Support. 

We have checked the reported query “Change Column Cells background based on value” from our side. You can achieve your requirement by using CellStyle property GridColumn and using converter in style.
 
 
Code snippet XAML: CellStyle applied to specific column. 
 
<Window.Resources> 
    <local:ColorConverter x:Key="converter"/> 
</Window.Resources> 
 
<syncfusion:GridTextColumn HeaderText="Order  id" MappingName="OrderID"> 
    <syncfusion:GridTextColumn.CellStyle> 
        <Style TargetType="syncfusion:GridCell"> 
            <Setter Property="Background" Value="{Binding Path=OrderID,Converter={StaticResource converter}}"/> 
        </Style> 
    </syncfusion:GridTextColumn.CellStyle> 
</syncfusion:GridTextColumn> 
 
We have attached the sample for your reference and you can download the sample from the following location. 
 
We have already published UG and KB for this use case and you can refer from the following locations. 
 
Please let us know if you would require further assistance. 
 
Regards, 
Jayaleshwari N. 


CONFIRMATION

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

;