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.
Unfortunately, activation email could not send to your email. Please try again.

DateTime RangeNavigator C# binding

Thread ID:





115927 Feb 27,2014 04:54 AM Feb 28,2014 06:49 AM WinRT 3
Tags: SfDateTimeRangeNavigator
Klemen Ošlaj
Asked On February 27, 2014 04:54 AM

I am wondering, how can I bind SelectedData property of RangeNavigator to charts series itemsource using C#? I need this, because I create Chart series dynamically in C#, so I have to set binding there. But thus far I was unsuccessful.

Here is piece of code:
            ((Model)holder.DataContext).Chart = new SfChart();
            ((Model)holder.DataContext).Chart.PrimaryAxis = new DateTimeAxis();
            ((Model)holder.DataContext).Chart.SecondaryAxis = new NumericalAxis();
            ((Model)holder.DataContext).Chart.Series = new ChartSeriesCollection();
            ColumnSeries column = new ColumnSeries();
            column.XBindingPath = "_Date";
            column.YBindingPath = "High";
            Binding b = new Binding();
            b.Source = RangeNavigator.SelectedData;
            b.ElementName = "RangeNavigator";
            column.SetBinding(ColumnSeries.ItemsSourceProperty, b);

Error: Converter failed to convert value of type 'Syncfusion.UI.Xaml.Charts.SfDateTimeRangeNavigator' to type 'IBindableIterable'; BindingExpression: Path='' DataItem='Syncfusion.UI.Xaml.Charts.SfDateTimeRangeNavigator'; target element is 'Syncfusion.UI.Xaml.Charts.ColumnSeries' (Name='null'); target property is 'ItemsSource' (type 'IBindableIterable'). 

Attachment: DateTimeRangeNavigator_284b07cd.zip

Klemen Ošlaj
Replied On February 27, 2014 04:59 AM

Sorry wrong attachment
Attachment: DateTimeRangeNavigatorDemo_cef1fe73.zip

Satheesh Kumar T [Syncfusion]
Replied On February 28, 2014 06:23 AM

Hi Klemen,

Thanks for using Syncfusion Products.

We have analyzed your query and given sample. The issue is due to the problem with your binding. This can be fixed as in below code snippet.

Code Snippet [C#]:

ColumnSeries column = new ColumnSeries();
column.XBindingPath = "_Date";
column.YBindingPath = "High";
Binding sourceBind = new Binding();
sourceBind.Source = RangeNavigator;
sourceBind.Path = new PropertyPath("SelectedData");
column.SetBinding(ColumnSeries.ItemsSourceProperty, sourceBind);

Please let us know if you have any queries.

Satheesh Kumar T

Klemen Ošlaj
Replied On February 28, 2014 06:49 AM

Works like a charm. Thanks a lot.


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.

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.