Data Binding to an ADO.NET DataView of a ViewModel

5 posts, 0 answers
  1. SqueakyDog
    SqueakyDog avatar
    3 posts
    Member since:
    May 2011

    Posted 21 Jun 2011 Link to this post

    I'm data binding my RadChart (WPF Q1 2011 SP1) control to an ADO.NET DataView exposed through a property of my ViewModel (currently hosted in the UserControl's code-behind--similar to this implemenation (later plan to use multiple-series mapping): http://www.telerik.com/ClientsFiles/275600_WpfApplication1.zip

    It almost works until I try to raise an OnPropertyChanged event for the VMs INotifyPropertyChanged implementation.  I get:

    {"No generic method 'Average' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic. "}

    [System.InvalidOperationException]: {"No generic method 'Average' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic. "}

    Data: {System.Collections.ListDictionaryInternal}

    HelpLink: null

    InnerException: null

    Message: "No generic method 'Average' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic. "

    Source: "System.Core"

    StackTrace: " at System.Linq.Expressions.Expression.FindMethod(Type type, String methodName, Type[] typeArgs, Expression[] args, BindingFlags flags)\r\n at System.Linq.Expressions.Expression.Call(Type type, String methodName, Type[] typeArguments, Expression[] arguments)\r\n at Telerik.Windows.Data.Expressions.EnumerableSelectorAggregateFunctionExpressionBuilder.CreateMethodCallExpression(LambdaExpression memberSelectorExpression) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Expressions\\Grouping\\Aggregates\\EnumerableSelectorAggregateFunctionExpressionBuilder.cs:line 48\r\n at Telerik.Windows.Data.Expressions.EnumerableSelectorAggregateFunctionExpressionBuilder.CreateAggregateExpression() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Expressions\\Grouping\\Aggregates\\EnumerableSelectorAggregateFunctionExpressionBuilder.cs:line 30\r\n at Telerik.Windows.Data.EnumerableSelectorAggregateFunction.CreateAggregateExpression(Expression enumerable

    Expression) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Data\\Grouping\\Aggregates\\EnumerableSelectorAggregateFunction.cs:line 76\r\n at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.<ProjectionPropertyValueExpressions>b__3(AggregateFunction f) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Expressions\\Grouping\\GroupDescriptorExpressionBuilder.cs:line 288\r\n at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()\r\n at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateProjectionInitExpression() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Expressions\\Grouping\\GroupDescriptorExpressionBuilder.cs:line 279\r\n at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateAggregateFunctionsProjectionMemberBin

    ding() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Expressions\\Grouping\\GroupDescriptorExpressionBuilder.cs:line 272\r\n at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.<CreateMemberBindings>d__0.MoveNext() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Expressions\\Grouping\\GroupDescriptorExpressionBuilder.cs:line 173\r\n at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n at System.Dynamic.Utils.CollectionExtensions.ToReadOnly[T](IEnumerable`1 enumerable)\r\n at System.Linq.Expressions.Expression.MemberInit(NewExpression newExpression, IEnumerable`1 bindings)\r\n at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateSelectBodyExpression() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Expressions\\Grouping\\GroupDescriptorExpressionBuilder.cs:line 161\r\n at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateResultSelectorExpressio

    n() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Expressions\\Grouping\\GroupDescriptorExpressionBuilder.cs:line 153\r\n at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.get_ResultSelectorExpression() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Expressions\\Grouping\\GroupDescriptorExpressionBuilder.cs:line 109\r\n at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilderBase.CreateQuery() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Expressions\\Grouping\\GroupDescriptorExpressionBuilderBase.cs:line 18\r\n at Telerik.Windows.Data.Expressions.GroupDescriptorCollectionExpressionBuilder.CreateQuery() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Expressions\\Grouping\\GroupDescriptorCollectionExpressionBuilder.cs:line 28\r\n at Telerik.Windows.Data.QueryableExtensions.GroupBy(IQueryable source, IEnumerable`1 groupDescriptors) in c:\\Builds\\WPF_Scrum\\Release_WPF\

    \Sources\\Development\\Core\\Data\\Collections\\QueryableExtensions.cs:line 184\r\n at Telerik.Windows.Data.QueryableCollectionView.CreateView() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollectionView.cs:line 480\r\n at Telerik.Windows.Data.QueryableCollectionView.get_QueryableView() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollectionView.cs:line 511\r\n at Telerik.Windows.Data.QueryableCollectionView.CreateInternalList() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollectionView.cs:line 575\r\n at Telerik.Windows.Data.QueryableCollectionView.EnsureInternalList() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollectionView.cs:line 563\r\n at Telerik.Windows.Data.QueryableCollectionView.get_InternalList() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\Queryab

    leCollectionView.cs:line 554\r\n at Telerik.Windows.Data.QueryableCollectionView.GroupedIndexOf(Object item) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollectionView.cs:line 1499\r\n at Telerik.Windows.Data.QueryableCollectionView.InternalIndexOf(Object item) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollectionView.cs:line 1491\r\n at Telerik.Windows.Data.QueryableCollectionView.TryRestorePreviousCurrency() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollectionView.cs:line 847\r\n at Telerik.Windows.Data.QueryableCollectionView.InitializeCurrencyOnRefresh() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollectionView.cs:line 843\r\n at Telerik.Windows.Data.QueryableCollectionView.RefreshOverride() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollect

    ionView.cs:line 824\r\n at Telerik.Windows.Data.QueryableCollectionView.RefreshInternal() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollectionView.cs:line 772\r\n at Telerik.Windows.Data.QueryableCollectionView.RefreshOrDefer() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollectionView.cs:line 767\r\n at Telerik.Windows.Data.QueryableCollectionView.InvalidatePagingAndRefresh() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollectionView.cs:line 393\r\n at Telerik.Windows.Data.QueryableCollectionView.OnGroupDescriptorsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollectionView.cs:line 416\r\n at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)\r\n at Telerik.Windows.Data.R

    adObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\RadObservableCollection.cs:line 143\r\n at Telerik.Windows.Data.ObservableItemCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\ObservableItemCollection.cs:line 93\r\n at Telerik.Windows.Data.RadObservableCollection`1.InsertItem(Int32 index, T item) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Core\\Data\\Collections\\RadObservableCollection.cs:line 190\r\n at Telerik.Windows.Controls.Charting.DataBindingHelper.PerformSampling(QueryableCollectionView dataEngine, Int32 samplingThreshold, IEnumerable`1 samplingFunctions) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\Data\\DataBindingHelper.cs:line 759\r\n at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessNoGrouping(Series

    Mapping seriesMapping, QueryableCollectionView dataEngine, Int32 samplingThreshold, ZoomScrollSettings zoomScrollSettings, ISeriesDefinition defaultSeriesDefinition, AxisRangeState axisXRangeState) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\Data\\DataBindingHelper.cs:line 460\r\n at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessMapping(SeriesMapping seriesMapping, QueryableCollectionView dataEngine, Int32 samplingThreshold, ZoomScrollSettings zoomScrollSettings, ISeriesDefinition defaultSeriesDefinition, AxisRangeState axisXRangeState) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\Data\\DataBindingHelper.cs:line 271\r\n at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessMappings(SeriesMappingCollection seriesMappings, QueryableCollectionView dataEngine, Int32 samplingThreshold, ZoomScrollSettings zoomScrollSettings, ISeriesDefinition defaultSeriesDefinition, AxisRangeState axisXRangeState) in c:\\Builds

    \\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\Data\\DataBindingHelper.cs:line 245\r\n at Telerik.Windows.Controls.Charting.DataBindingHelper.GenerateDataSeries(Object originalData, SeriesMappingCollection seriesMappings, ISeriesDefinition defaultSeriesDefinition, ChartFilterDescriptorCollection globalFilterDescriptors, ChartSortDescriptorCollection globalSortDescriptors, SamplingSettings samplingSettings, ZoomScrollSettings zoomScrollSettings, AxisRangeState axisXRangeState) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\Data\\DataBindingHelper.cs:line 48\r\n at Telerik.Windows.Controls.RadChart.GenerateDataSeries(Object originalData, SeriesMappingCollection seriesMappings, ChartArea chartArea) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\RadChart.cs:line 1288\r\n at Telerik.Windows.Controls.RadChart.GenerateDataSeries(Object originalData) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Co

    ntrols\\Chart\\Chart\\RadChart.cs:line 1269\r\n at Telerik.Windows.Controls.RadChart.Rebind(Object originalData) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\RadChart.cs:line 894\r\n at Telerik.Windows.Controls.RadChart.Rebind() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\RadChart.cs:line 790\r\n at Telerik.Windows.Controls.Charting.SeriesMapping.RebindChart() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\Data\\SeriesMapping.cs:line 375\r\n at Telerik.Windows.Controls.Charting.SeriesMapping.ManageChangeNotifications(Object originalData, Object oldData) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\Data\\SeriesMapping.cs:line 354\r\n at Telerik.Windows.Controls.Charting.SeriesMapping.ItemsSourcePropertyChanged(DependencyObject target, DependencyPropertyChangedEventArgs args) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\

    Chart\\Chart\\Data\\SeriesMapping.cs:line 331\r\n at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)\r\n at System.Windows.Freezable.OnPropertyChanged(DependencyPropertyChangedEventArgs e)\r\n at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)\r\n at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)\r\n at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp)\r\n at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)\r\n at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)\r\n at MS.Internal.Data.PropertyPathWorker.Upd

    ateSourceValueState(Int32 k, ICollectionView collectionView)\r\n at MS.Internal.Data.ClrBindingWorker.OnSourcePropertyChanged(Object o, String propName)\r\n at MS.Internal.Data.PropertyPathWorker.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)\r\n at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)\r\n at System.ComponentModel.PropertyChangedEventManager.OnPropertyChanged(Object sender, PropertyChangedEventArgs args)\r\n at GenesysShell.DataPointSetViewModel.RaisePropertyChanged(String  propertyName) in C:\\Data\\tfs\\...\\MainView.xaml.cs:line 50\r\n at ....DataPointSetViewModel.set_Load(DataView value) in C:\\Data\\tfs\\...\\Views\\MainView.xaml.cs:line 69\r\n at ....MainView.cmdProcess_Click(Object sender, RoutedEventArgs e) in C:\\Data\\tfs\\...\\Views\\MainView.xaml.cs:line 268"

    TargetSite: {System.Reflection.MethodInfo FindMethod(System.Type, System.String, System.Type[], System.Linq.Expressions.Expression[], System.Reflection.BindingFlags)}

    This thread:
    http://www.telerik.com/community/forums/wpf/chart/error-in-aplying-aggregate-function-when-binding-from-datatable.aspx
    talks about setting the "FieldType" to double for correcting a similar error, like so:

    ItemMapping mapping = new ItemMapping("Sales", DataPointMember.YValue, ChartAggregateFunction.Sum);
    mapping.FieldType = typeof(double);

    But I'm using wpf design-time binding, not c#--how would this be done in xaml (as I get an error):

    <charting:ItemMapping FieldName="Value" DataPointMember="YValue" FieldType="double">
    </charting:ItemMapping>
    ?

    My XAML looks like this:

    <UserControl ...

    <telerik:RadChart x:Name="chartSegTrak" Margin="0,45,0,10" UseDefaultLayout="False">

        <charting:ChartArea x:Name="segTrakChartArea" EnableAnimations="False">
        </charting:ChartArea>
                       
        <telerik:RadChart.SeriesMappings>
            <charting:SeriesMapping ChartAreaName="ChartArea" ItemsSource="{Binding Load}">

                <charting:SeriesMapping.SeriesDefinition>
                    <charting:LineSeriesDefinition>
                    </charting:LineSeriesDefinition>
                </charting:SeriesMapping.SeriesDefinition>

                <charting:ItemMapping FieldName="Value" DataPointMember="YValue">
                </charting:ItemMapping>

            </charting:SeriesMapping>

        </telerik:RadChart.SeriesMappings>

    </telerik:RadChart>
    ...

    The code-behind looks like this:

        //
        // ViewModel code...
        //
        public class DataPointSetViewModel : INotifyPropertyChanged
        {
            private string _name;

            public DataPointSetViewModel(){}

            public event PropertyChangedEventHandler PropertyChanged;

            protected void RaisePropertyChanged(String propertyName)
            {
                PropertyChangedEventHandler handler = this.PropertyChanged;

                if (handler != null)
                    handler(this, new PropertyChangedEventArgs(propertyName));
            }

            public DataView Load
            {
                set
                {
                    _load = value;
                    RaisePropertyChanged("Load");               
                }
                get
                {
                    return _load;
                }
            }
            ...
        }

     //
     // Window/UserControl code...
     //
     public partial class MainView : UserControl
     {
            DataPointSetViewModel _vm;

            public MainView()
            {
                _vm = new DataPointSetViewModel();
                this.DataContext = _vm; 
                InitializeComponent();
            }
    ...
            private void cmdProcess_Click(object sender, RoutedEventArgs e)
            {
                ...

                try
                {
    ...
                    DataView dvLoad = new DataView(<someclass>.DataSet.GenesysDataPoint);
                    dvLoad.RowFilter = "StudyId=5 AND GlobalResourceId=2";
                    dvLoad.Sort = "Year, Month, Day, Hour";
                    _vm.Load = dvLoad;
                }
                catch (Exception ex)
                {
                    Cursor = System.Windows.Input.Cursors.Arrow;
                    MessageBox.Show("Error: " + ex.ToString());
                }
            }

     

    The UserControl's DataContext is set and I can two-way bind simple properties with success.  It's just the DataView two-way binding that's not working correctly.  Thanks!

  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 24 Jun 2011 Link to this post

    Hello,

    In WPF you can specify types in XAML using the Type xaml extension:

    <charting:ItemMapping FieldName="Value" DataPointMember="YValue" FieldType="{x:Type system:Double">

    In the above snippet, the system xml namespace is mapped like this:

    xmlns:system="clr-namespace:System;assembly=mscorlib"


    Best regards,
    Ves
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. SqueakyDog
    SqueakyDog avatar
    3 posts
    Member since:
    May 2011

    Posted 25 Jun 2011 Link to this post

    Thanks (rookie mistake)!

    Now I've slightly expanded the app to handle multiple SeriesMapping (just like the last post here: http://www.telerik.com/community/forums/wpf/chart/multiple-series.aspx ), but receive an error.  Note, I can bind to either one if I comment out the other one (in XAML and code-behind), but trying to bind to both results in the following error (while raising property-changed notification):

    [System.NullReferenceException]: {"Object reference not set to an instance of an object."}

    Data: {System.Collections.ListDictionaryInternal}

    HelpLink: null

    InnerException: null

    Message: "Object reference not set to an instance of an object."

    Source: "Telerik.Windows.Controls.Charting"

    StackTrace: " at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessMapping(SeriesMapping seriesMapping, QueryableCollectionView dataEngine, Int32 samplingThreshold, ZoomScrollSettings zoomScrollSettings, ISeriesDefinition defaultSeriesDefinition, AxisRangeState axisXRangeState) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\Data\\DataBindingHelper.cs:line 255\r\n at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessMappings(SeriesMappingCollection seriesMappings, QueryableCollectionView dataEngine, Int32 samplingThreshold, ZoomScrollSettings zoomScrollSettings, ISeriesDefinition defaultSeriesDefinition, AxisRangeState axisXRangeState) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\Data\\DataBindingHelper.cs:line 245\r\n at Telerik.Windows.Controls.Charting.DataBindingHelper.GenerateDataSeries(Object originalData, SeriesMappingCollection seriesMappings, ISeriesDefinition defaultSeriesDefinition, ChartFilterDe

    scriptorCollection globalFilterDescriptors, ChartSortDescriptorCollection globalSortDescriptors, SamplingSettings samplingSettings, ZoomScrollSettings zoomScrollSettings, AxisRangeState axisXRangeState) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\Data\\DataBindingHelper.cs:line 48\r\n at Telerik.Windows.Controls.RadChart.GenerateDataSeries(Object originalData, SeriesMappingCollection seriesMappings, ChartArea chartArea) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\RadChart.cs:line 1288\r\n at Telerik.Windows.Controls.RadChart.GenerateDataSeries(Object originalData) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\RadChart.cs:line 1279\r\n at Telerik.Windows.Controls.RadChart.Rebind(Object originalData) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\RadChart.cs:line 892\r\n at Telerik.Windows.Controls.RadChart.Rebind() in c:\\Builds\\WPF_Scrum\\Releas

    e_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\RadChart.cs:line 789\r\n at Telerik.Windows.Controls.Charting.SeriesMapping.RebindChart() in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\Data\\SeriesMapping.cs:line 374\r\n at Telerik.Windows.Controls.Charting.SeriesMapping.ManageChangeNotifications(Object originalData, Object oldData) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\Data\\SeriesMapping.cs:line 353\r\n at Telerik.Windows.Controls.Charting.SeriesMapping.ItemsSourcePropertyChanged(DependencyObject target, DependencyPropertyChangedEventArgs args) in c:\\Builds\\WPF_Scrum\\Release_WPF\\Sources\\Development\\Controls\\Chart\\Chart\\Data\\SeriesMapping.cs:line 330\r\n at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)\r\n at System.Windows.Freezable.OnPropertyChanged(DependencyPropertyChangedEventArgs e)\r\n at System.Windows.DependencyObject.NotifyPropertyChange(Dependency

    PropertyChangedEventArgs args)\r\n at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)\r\n at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp)\r\n at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)\r\n at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)\r\n at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView)\r\n at MS.Internal.Data.ClrBindingWorker.OnSourcePropertyChanged(Object o, String propName)\r\n at MS.Internal.Data.PropertyPathWorker.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)\r\n at

    System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)\r\n at System.ComponentModel.PropertyChangedEventManager.OnPropertyChanged(Object sender, PropertyChangedEventArgs args)\r\n at GenesysShell.DataPointSetViewModel.RaisePropertyChanged(String propertyName) in C:\\Data\\tfs\\PgprNwpcc\\Genesys\\GenesysShell\\GenesysShell\\Views\\MainView.xaml.cs:line 50\r\n at GenesysShell.DataPointSetViewModel.set_Load(DataView value) in C:\\Data\\tfs\\PgprNwpcc\\Genesys\\GenesysShell\\GenesysShell\\Views\\MainView.xaml.cs:line 69\r\n at GenesysShell.MainView.cmdProcess_Click(Object sender, RoutedEventArgs e) in C:\\Data\\tfs\\PgprNwpcc\\Genesys\\GenesysShell\\GenesysShell\\Views\\MainView.xaml.cs:line 268"

    TargetSite: {Telerik.Windows.Controls.Charting.DataSeriesCollection ProcessMapping(Telerik.Windows.Controls.Charting.SeriesMapping, Telerik.Windows.Data.QueryableCollectionView, Int32, Telerik.Windows.Controls.Charting.ZoomScrollSettings, Telerik.Windows.Controls.Charting.ISeriesDefinition, Telerik.Windows.Controls.AxisRangeState)}

     

     

    Here's the snippit of code where I'm setting up the DataView to be bound to the ViewModel in the code-behind:

                    DataView dvLoad = new DataView(<someClass>.DataSet.GenesysDataPoint);
                    dvLoad.RowFilter = "StudyId=5 AND GlobalResourceId=2";
                    dvLoad.Sort = "Year, Month, Day, Hour";
                    _vm.Load = dvLoad;

                    
    DataView dvThermal = new DataView(<someClass>.DataSet.GenesysDataPoint);
                    dvThermal.RowFilter = "StudyId=5 AND GlobalResourceId=4";
                    dvThermal.Sort = "Year, Month, Day, Hour";
                    ((DataPointSetViewModel)this.DataContext).Thermal = dvThermal;

    Here's the XAML:
    [Note how this is pretty much identical to the XAML in Giuseppe's last post here:  http://www.telerik.com/community/forums/wpf/chart/multiple-series.aspx ]

    ...
    ...
      
                    <telerik:RadChart x:Name="chartSegTrak" Margin="0,45,0,10" UseDefaultLayout="False">
      
                        <telerik:ChartArea x:Name="ChartArea1" EnableAnimations="False" />
                          
                        <telerik:RadChart.SeriesMappings>
      
                            <telerik:SeriesMapping ItemsSource="{Binding Load}" ChartAreaName="ChartArea1" >
      
                                <telerik:SeriesMapping.SeriesDefinition>
                                    <telerik:LineSeriesDefinition ShowItemLabels="False" />
                                </telerik:SeriesMapping.SeriesDefinition>
                                  
                                <telerik:SeriesMapping.ItemMappings>
                                    <telerik:ItemMapping DataPointMember="YValue" FieldName="Value" FieldType="{x:Type system:Double}" />
                                </telerik:SeriesMapping.ItemMappings>
                                  
                            </telerik:SeriesMapping>
      
      
                            <telerik:SeriesMapping ItemsSource="{Binding Thermal}" ChartAreaName="ChartArea1" >
      
                                <telerik:SeriesMapping.SeriesDefinition>
                                    <telerik:LineSeriesDefinition ShowItemLabels="False" />
                                </telerik:SeriesMapping.SeriesDefinition>
      
                                <telerik:SeriesMapping.ItemMappings>
                                    <telerik:ItemMapping DataPointMember="YValue" FieldName="Value" FieldType="{x:Type system:Double}" />
                                </telerik:SeriesMapping.ItemMappings>
                                  
                            </telerik:SeriesMapping>
      
                        </telerik:RadChart.SeriesMappings>
                          
                    </telerik:RadChart>

    Thank you.

  5. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 29 Jun 2011 Link to this post

    Hello,

    Indeed, the problem exists in the latest official release. It has been fixed in the latest internal build. Please, download it and give it a try. Of course, the fix will be included in the upcoming Q2 release.

    Best regards,
    Ves
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. SqueakyDog
    SqueakyDog avatar
    3 posts
    Member since:
    May 2011

    Posted 29 Jun 2011 Link to this post

    Thanks.
Back to Top
UI for WPF is Visual Studio 2017 Ready