Question about binding to ChartSeriesProvider.Source ?

2 posts, 1 answers
  1. Jan Białokozowicz
    Jan Białokozowicz avatar
    7 posts
    Member since:
    Jan 2010

    Posted 25 Oct 2013 Link to this post

    In ChartView and PivotGrid integration tutorial\example
    (http://www.telerik.com/help/silverlight/radpivotgrid-features-radchartview-integration.html)

    you have following xaml piece:

    <telerik:RadCartesianChart.SeriesProvider>
        <telerik:ChartSeriesProvider Source="{Binding SeriesSource}" >
            <telerik:ChartSeriesProvider.SeriesDescriptors >
                <telerik:CategoricalSeriesDescriptor  x:Name="seriesDescriptor"  ItemsSourcePath="Items" ValuePath="Value" CategoryPath="NameX"/>
            </telerik:ChartSeriesProvider.SeriesDescriptors>
        </telerik:ChartSeriesProvider>
    </telerik:RadCartesianChart.SeriesProvider>

    I want to know how to do this line - but without XAML:

    <telerik:ChartSeriesProvider Source="{Binding SeriesSource}" >

    My concern is ChartSeriesProvider don't have SetBinding method, and i cant do this with RadCartesianChart.
    Any help would be great :)

    Greetings.

      
  2. Answer
    Milena
    Admin
    Milena avatar
    204 posts

    Posted 28 Oct 2013 Link to this post

    Hi Jan,

    ChartSeriesProvider doesn't have a SetBinding() method because it inherits directly DependencyObject, instead of FrameworkElement. You can still use data binding, however instead of using the FrameworkElement.SetBinding() instance method you need to use the BindingOperations.SetBinding() static method. Here's an example:

    Binding binding = new Binding("SeriesInfos") { Source = viewmodel };
    BindingOperations.SetBinding(radCartesianChart1.SeriesProvider, ChartSeriesProvider.SourceProperty, binding);

    I hope that this is the solution you are looking for. If it is not - please describe in more details your requirements.

    Regards,
    Milena
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
Back to Top