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

Converter with bind parameter

Thread ID:





129521 Mar 23,2017 11:48 AM UTC Mar 28,2017 04:50 AM UTC WPF 3
Tags: SfDataGrid
Gianni Ghezzi
Asked On March 23, 2017 11:48 AM UTC

I've a sfDataGrid with a column MYDATE and colum MYTIMESPAN
I've made a converter on the cell MYDATE to change it adding the MYTIMESPAN cell value, the problem is that I'm no able to pass both values to the converter. With converterparams I can't bind to MYTIMESPAN path because 'Binding' can only be set on a DependencyProperty of a DependencyObject
I've also tried with MultiBindigs but the converter go in loop.
How I can solve this!??

Below you can see my working converter but in this way I've no access to the MYTIMESPAN cell value:

                                <syncfusion:GridTemplateColumn HeaderText="MYDATE " MappingName="MYDATE ">
                                                <Label Content="{Binding Path=MYDATE , Converter={converters:myMYDATEConverter}}" />

Balamurugan Rajaraman [Syncfusion]
Replied On March 25, 2017 09:47 AM UTC

Hi Gianni. 

Thank you for contact Syncfusion support. 

We have analyzed your query “Converter with bind parameter”. You can able to achieve your requirement by writing the converter for the Value Binding to the DateTime column as like the below provide code sample. 
public class converter : IValueConverter 
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 
            DateTime today = (value as Date)._Date; 
            long duration = (value as Date).DateTime.Hours; 
            today = today.AddHours(duration); 
            return today; 
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 
            throw new NotImplementedException(); 


                <syncfusion:GridDateTimeColumn MappingName="_Date"  ValueBinding="{Binding Converter={StaticResource convert},ConverterParameter=SfDataGrid}" /> 
                <syncfusion:GridTimeSpanColumn MappingName="DateTime"  Format = "hh:mm:ss"/> 

In this sample we have written the Converter for the DateTime Column in this Converter we have added the TimeSpan value with DateTime value. We have attached the sample for your reference and you can download it from the below location. 

Balamurugan R

Gianni Ghezzi
Replied On March 27, 2017 12:32 PM UTC

Great! It work fine! My mistake was to use the converter inside the GridTemplateColumn.
Your support is excellent... and thanks to my good publicity one my customer has purchased your WPF license!

Balamurugan Rajaraman [Syncfusion]
Replied On March 28, 2017 04:50 AM UTC

Hi Gianni, 

Thank you for the update. 

Please let us know further assistance 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