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

Converter with bind parameter

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}}" />

3 Replies

BR Balamurugan Rajaraman Syncfusion Team 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

UN Unknown Syncfusion Team 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!

BR Balamurugan Rajaraman Syncfusion Team March 28, 2017 04:50 AM UTC

Hi Gianni, 

Thank you for the update. 

Please let us know further assistance on this. 

Balamurugan R 

Live Chat Icon For mobile
Up arrow icon