As I recall, you need to define your own non-generic collection rather than exposing a generic ObservableCollection.
Up vote 0 down vote favorite share g+ share fb share tw.
I've created a Chart control and after a while I decided to add multiserie capabilities to it. I implemented the feature using a dependence property of type ObservableCollection like this: private static DependencyPropertyKey SeriesPropertyKey = DependencyProperty. RegisterReadOnly("Series", typeof(ObservableCollection), typeof(Chart), new FrameworkPropertyMetadata(new ObservableCollection())); public static DependencyProperty SeriesProperty = SeriesPropertyKey.
DependencyProperty; I use this property from XAML calling it this way: The ChartSerie code is just a container of the ChartData: public static DependencyProperty DataProperty = DependencyProperty. Register("Data", typeof(ObservableCollection), typeof(ChartSerie), new FrameworkPropertyMetadata(OnDataChanged)); The problem I'm facing is that the ChartSerie instances are not being populated with the data coming from the binding. Their Data property is always set to null.
I have no binding errors at the output of the visual studio. Thanks in advance. EDIT: After digging a bit looks like there is a real binding issue here.
Looks like the DataContext of Chart is not inherited by ChartSerie. ChartSerie is a FrameworkElement just in case this matters c# wpf xaml binding dependency-properties link|improve this question edited Oct 20 '11 at 14:39 asked Oct 20 '11 at 7:59SoMoS3,196718 78% accept rate.
As I recall, you need to define your own non-generic collection rather than exposing a generic ObservableCollection: public class ChartSeriesCollection : ObservableCollection { } ... public static readonly DependencyProperty ChartSeriesProperty = DependencyProperty. Register( "ChartSeries", typeof(ChartSeriesCollection), typeof(MyClass)); If you don't do this, things get very weird indeed.
Anyway I will check. Initially I was exposing the generic collection as a single dependence property of the chart (the data of just a serie,not as a list of series) and it was working. – SoMoS Oct 20 '11 at 8:27 I replaced the collection and now I'm seeing binding issues, can you check my edit?
Thanks! – SoMoS Oct 20 '11 at 14:40 You should point me to your blog article in this first question :) Thanks again Kent. – SoMoS Oct 21 '11 at 7:09.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.