/// <summary>
 /// Instantiates a new instance of the SeriesHostAxesCollection class.
 /// </summary>
 /// <param name="seriesHost">The series host.</param>
 /// <param name="persistentAxes">A collection of axes that can never be
 /// removed from the chart.</param>
 internal SeriesHostAxesCollection(ISeriesHost seriesHost, UniqueObservableCollection <IAxis> persistentAxes)
     : this(seriesHost)
 {
     Debug.Assert(persistentAxes != null, "Persistent axes collection cannot be null.");
     this.SeriesHost     = seriesHost;
     this.PersistentAxes = persistentAxes;
     this.PersistentAxes.CollectionChanged += PersistentAxesCollectionChanged;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the Chart class.
        /// </summary>
        public Chart()
        {
            DefaultStyleKey = typeof(Chart);
            // Create the backing collection for Series
            UniqueObservableCollection <ISeries> series = new UniqueObservableCollection <ISeries>();

            series.CollectionChanged += 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);
            };
        }
 /// <summary>
 /// Instantiates a new instance of the SeriesHostAxesCollection class.
 /// </summary>
 /// <param name="seriesHost">The series host.</param>
 internal SeriesHostAxesCollection(ISeriesHost seriesHost)
 {
     this.SeriesHost         = seriesHost;
     this.PersistentAxes     = new UniqueObservableCollection <IAxis>();
     this.CollectionChanged += ThisCollectionChanged;
 }