/// <summary> /// Initializes a new instance of the Chart class. /// </summary> public Chart() { #if SILVERLIGHT DefaultStyleKey = typeof(Chart); #endif // Create the backing collection for Series var series = new UniqueObservableCollection <ISeries>(); series.CollectionChanged += SeriesCollectionChanged; _series = series; // Create the backing collection for Axes var axes = new UniqueObservableCollection <IAxis>(); _axes = axes; ObservableCollection <IAxis> actualAxes = new SeriesHostAxesCollection(this, axes); actualAxes.CollectionChanged += ActualAxesCollectionChanged; InternalActualAxes = actualAxes; ActualAxes = new ReadOnlyCollection <IAxis>(InternalActualAxes); // Create collection for LegendItems LegendItems = new AggregatedObservableCollection <object>(); ChartAreaChildren = new AggregatedObservableCollection <UIElement>(); ChartAreaChildren.ChildCollections.Add(_edgeAxes); ChartAreaChildren.ChildCollections.Add(_backgroundElements); ChartAreaChildren.ChildCollections.Add(Series); ChartAreaChildren.ChildCollections.Add(_foregroundElements); _chartAreaChildrenListAdapter.Collection = ChartAreaChildren; // Create a dispenser ResourceDictionaryDispenser = new ResourceDictionaryDispenser(); ResourceDictionaryDispenser.ResourceDictionariesChanged += delegate { OnResourceDictionariesChanged(EventArgs.Empty); }; }
/// <summary> /// Initializes a new instance of the Chart class. /// </summary> public Chart() { #if SILVERLIGHT DefaultStyleKey = typeof(Chart); #endif // Create the backing collection for Series UniqueObservableCollection <Series> series = new UniqueObservableCollection <Series>(); series.CollectionChanged += new NotifyCollectionChangedEventHandler(OnSeriesCollectionChanged); _series = series; // Create the backing collection for Axes UniqueObservableCollection <IAxis> axes = new UniqueObservableCollection <IAxis>(); _axes = axes; ObservableCollection <IAxis> actualAxes = new SeriesHostAxesCollection(this, axes); actualAxes.CollectionChanged += ActualAxesCollectionChanged; this.InternalActualAxes = actualAxes; this.ActualAxes = new ReadOnlyCollection <IAxis>(InternalActualAxes); // Create collection for LegendItems NoResetObservableCollection <UIElement> chartLegendItems = new AggregatedObservableCollection <UIElement>(); _legendChildrenLegendAdapter.Collection = chartLegendItems; LegendItems = chartLegendItems; ISeriesHost host = this as ISeriesHost; host.GlobalSeriesIndexesInvalidated += OnGlobalSeriesIndexesInvalidated; ChartAreaChildren = new AggregatedObservableCollection <UIElement>(); ChartAreaChildren.ChildCollections.Add(_edgeAxes); ChartAreaChildren.ChildCollections.Add(_backgroundElements); ChartAreaChildren.ChildCollections.Add(Series); ChartAreaChildren.ChildCollections.Add(_foregroundElements); _chartAreaChildrenListAdapter.Collection = ChartAreaChildren; // Create style dispenser StyleDispenser = new StyleDispenser(); }
/// <summary> /// Initializes a new instance of the Chart class. /// </summary> public Chart() { // Create the backing collection for Series UniqueObservableCollection <ISeries> series = new UniqueObservableCollection <ISeries>(); series.CollectionChanged += new NotifyCollectionChangedEventHandler(SeriesCollectionChanged); _series = series; // Create the backing collection for Axes UniqueObservableCollection <IAxis> axes = new UniqueObservableCollection <IAxis>(); _axes = axes; ObservableCollection <IAxis> actualAxes = new SeriesHostAxesCollection(this, axes); actualAxes.CollectionChanged += ActualAxesCollectionChanged; this.InternalActualAxes = actualAxes; this.ActualAxes = new ReadOnlyCollection <IAxis>(InternalActualAxes); // Create collection for LegendItems LegendItems = new AggregatedObservableCollection <object>(); ChartAreaChildren = new AggregatedObservableCollection <UIElement>(); ChartAreaChildren.ChildCollections.Add(_edgeAxes); ChartAreaChildren.ChildCollections.Add(_backgroundElements); ChartAreaChildren.ChildCollections.Add(Series); ChartAreaChildren.ChildCollections.Add(_foregroundElements); _chartAreaChildrenListAdapter.Collection = ChartAreaChildren; // Create a dispenser ResourceDictionaryDispenser = new ResourceDictionaryDispenser(); ResourceDictionaryDispenser.ResourceDictionariesChanged += delegate { OnResourceDictionariesChanged(EventArgs.Empty); }; }