This is a migrated thread and some comments may be shown as answers.

Binding problems with ChartSeriesProvider

2 Answers 169 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Ingólfur
Top achievements
Rank 1
Ingólfur asked on 29 Apr 2013, 02:24 PM
I'm having problems binding my MVVM ViewModel to the ChartSeriesProvider. It's like it's not a part of the Visual Tree.

<telerik:RadCartesianChart>
             
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:CategoricalAxis/>
            </telerik:RadCartesianChart.HorizontalAxis>
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis/>
            </telerik:RadCartesianChart.VerticalAxis>
            <telerik:RadCartesianChart.SeriesProvider>
                 
                <telerik:ChartSeriesProvider Source="{Binding Path=CollectionView}">
                    <telerik:ChartSeriesProvider.SeriesDescriptors>
 
                        <telerik:CategoricalSeriesDescriptor ItemsSourcePath="Items"
                                                             ValuePath="Value"
                                                             CategoryPath="Month">
                            <telerik:CategoricalSeriesDescriptor.Style>
                                <Style  TargetType="telerik:LineSeries">
                                </Style>
                            </telerik:CategoricalSeriesDescriptor.Style>
                        </telerik:CategoricalSeriesDescriptor>
                    </telerik:ChartSeriesProvider.SeriesDescriptors>
                     
                </telerik:ChartSeriesProvider>
                 
            </telerik:RadCartesianChart.SeriesProvider>
        </telerik:RadCartesianChart>

and inside the ViewModel that is bound to this view (is its DataContext)

private ICollectionView _collectionView;
public ICollectionView CollectionView
{
    get
    {
        if (this._collectionView == null)
        {
            this._collectionView = CollectionViewSource.GetDefaultView(this.Items);
                using (this._collectionView.DeferRefresh())
                {
                    this._collectionView.SortDescriptions.Clear();
                    this._collectionView.SortDescriptions.Add(new SortDescription("Order", ListSortDirection.Ascending));
                }
        }
        return this._collectionView;
    }
}

Everything else in the View binds ok but I always get no series and according to Snoop

RadChartView Cannot find governing FrameworkElement or FrameworkContentElement for target element

2 Answers, 1 is accepted

Sort by
0
Ingólfur
Top achievements
Rank 1
answered on 30 Apr 2013, 10:44 AM
Ok I am using Caliburn.Micro to wire up the DataContexts and I guess the problem was there somewhere instead of in Telerik code. Sorry about that.
0
Nitzan
Top achievements
Rank 1
answered on 22 Oct 2020, 07:22 AM

I realize that's an ancient thread... but I seem to be having the exact same binding error with version 2020.3 when binding the source of my telerik:ChartSeriesProvider element:

<chart:RadCartesianChart.SeriesProvider>
                <chartView:ChartSeriesProvider Source="{Binding Path=ChannelData}">
                    <chartView:ChartSeriesProvider.SeriesDescriptors>
                        <chartView:ScatterSeriesDescriptor XValuePath="Time" YValuePath="MilliVolts"
                                                             ItemsSourcePath="ECGSamples" >
                            <chartView:ScatterSeriesDescriptor.Style>
                                <Style TargetType="{x:Type chartView:ScatterLineSeries}">
                                    <Setter Property="StrokeThickness" Value="1" />
                                    <Setter Property="Stroke" Value="{Binding Color, Converter={StaticResource ColorToBrushConverter}}" />
                                </Style>
                            </chartView:ScatterSeriesDescriptor.Style>
                             
                        </chartView:ScatterSeriesDescriptor>
                    </chartView:ChartSeriesProvider.SeriesDescriptors>
                </chartView:ChartSeriesProvider>
            </chart:RadCartesianChart.SeriesProvider>

 

I get a binding error 2: RadChartView Cannot find governing FrameworkElement or FrameworkContentElement for target element

Any idea?

Any idea?

Tags
ChartView
Asked by
Ingólfur
Top achievements
Rank 1
Answers by
Ingólfur
Top achievements
Rank 1
Nitzan
Top achievements
Rank 1
Share this question
or