A class that rotates through a list of ResourceDictionaries.
Наследование: IResourceDictionaryDispenser
Пример #1
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);
            };
        }
Пример #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);
            };
        }
Пример #3
0
 /// <summary>
 /// Returns a rotating enumerator of ResourceDictionary objects that coordinates
 /// with the dispenser object to ensure that no two enumerators are on the same
 /// item. If the dispenser is reset or its collection is changed then the
 /// enumerators are also reset.
 /// </summary>
 /// <param name="predicate">A predicate that returns a value indicating
 /// whether to return an item.</param>
 /// <returns>An enumerator of ResourceDictionaries.</returns>
 public IEnumerator <ResourceDictionary> GetResourceDictionariesWhere(Func <ResourceDictionary, bool> predicate)
 {
     return(ResourceDictionaryDispenser.GetResourceDictionariesWhere(predicate));
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of a ResourceDictionaryEnumerator.
 /// </summary>
 /// <param name="dispenser">The dispenser that dispensed this
 /// ResourceDictionaryEnumerator.</param>
 /// <param name="predicate">A predicate used to determine which
 /// ResourceDictionaries to return.</param>
 public ResourceDictionaryEnumerator(ResourceDictionaryDispenser dispenser, Func <ResourceDictionary, bool> predicate)
 {
     ResourceDictionaryDispenser = dispenser;
     Predicate = predicate;
 }
Пример #5
0
 /// <summary>
 /// Raises the EnumeratorResourceDictionaryDispensed.
 /// </summary>
 /// <param name="args">Information about the ResourceDictionary dispensed.</param>
 protected virtual void OnStyleDispensed(ResourceDictionaryDispensedEventArgs args)
 {
     ResourceDictionaryDispenser.EnumeratorResourceDictionaryDispensed(this, args);
 }