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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to pass the current binded datagrid item to the converter when using a conditional formatting

Thread ID:





132373 Aug 29,2017 10:41 AM UTC Aug 31,2017 04:46 AM UTC WPF 3
Tags: SfDataGrid
Asked On August 29, 2017 10:41 AM UTC


I'm analyzing your example named "Conditional Formatting Demo" in your online documentation on SfDatagrid control.
I'd like to implement a user interface where, for a particular column, the backgound color is changed according to some condition.
Your example is very good and uses a Converter that can calculate the correct background color related to the value of the associated cell but uses only the cell value without any parameter.
But, to decide witch color to return in my converter, I'd need not only the value of the cell but also other properties that belong to the current binded record of the currently displayed row.
So I need to pass an object parameter to that converter that should let me have access to the whole record binded to the row it is currently displayed.
How can I pass such a parameter to my converter?
Thank you.


Balamurugan Rajaraman [Syncfusion]
Replied On August 30, 2017 03:27 PM UTC

Hi Silvio, 
Thanks for contacting Syncfusion support. 
We have checked your query “How to pass additional parameter to the converter”. You can able to achieve your requirement using the MuliBinding concept by this way you can able to pass the additional parameter to the converter. Here we have passed the cell value and with additionally pass the collection of the particular row in to the converter as like the below code sample.  
        <local:ViewModel x:Key="viewmodel" /> 
        <local:CustomRowStyleMultiValueConverter x:Key="CustomRowStyleMultiValueConverter" /> 
        <Style x:Key="stylecolor" TargetType="Syncfusion:VirtualizingCellsControl"> 
            <Setter Property="Background"> 
                    <MultiBinding Converter="{StaticResource CustomRowStyleMultiValueConverter}"> 
                        <Binding Path="IsChecked" /> 
                        <Binding RelativeSource="{RelativeSource Self}" /> 

we have created sample as per the requirement and attached that sample for your reference. You can able to get it from the below link
Pease refer the below link for getting more information regarding this 
Balamurugan R 

Replied On August 30, 2017 04:54 PM UTC

Dear Balamurugan,

thank you very much for your very precious help!

MultiBinding was exactly what I needed.

Silvio Scattaglia

Balamurugan Rajaraman [Syncfusion]
Replied On August 31, 2017 04:46 AM UTC

Hi Silvio, 
Thanks for the update, 
Please let us know if need any further assist on this. 
Balamurugan R 


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

Live Chat Icon For mobile
Live Chat Icon