public static void ClearFast(this LegendCollection collection) { collection.SuspendUpdates(); while (collection.Count > 0) { collection.RemoveAt(collection.Count - 1); } collection.ResumeUpdates(); }
/// <summary> /// Initializes a new instance of the Map class. /// </summary> public Map() { InitGeocoder(false); // Adjust base props: #if WPF BackColor = System.Windows.Media.Colors.Transparent; #else BackColor = Color.White; #endif PictureAlign = PictureAlignEnum.Stretch; // Various styles: MarkerStyles = new MarkerStyleCollection(this); LineStyles = new LineStyleCollection(this); KmlItemStyles = new KmlItemStyleCollection(this); // Main collections: Layers = new LayerCollection(this); Legends = new LegendCollection(this); }
/// <summary> /// Initializes the various properties of the class /// </summary> private void Init() { // Initialize colorSets //ColorSets = new ColorSets(); // Initialize tooltip ToolTips = new ToolTipCollection(); // Initialize title list Titles = new TitleCollection(); // Initialize legend list Legends = new LegendCollection(); // Initialize trendLine list TrendLines = new TrendLineCollection(); // Initialize AxesX list AxesX = new AxisCollection(); // Initialize AxesY list AxesY = new AxisCollection(); // Initialize Series list Series = new DataSeriesCollection(); // Initialize PlotArea PlotArea = new PlotArea() { Chart = this }; // Attach event handler on collection changed event with ToolTip collection ToolTips.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(ToolTips_CollectionChanged); // Attach event handler on collection changed event with Title collection Titles.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Titles_CollectionChanged); // Attach event handler on collection changed event with Legend collection Legends.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Legends_CollectionChanged); // Attach event handler on collection changed event with TrendLines collection TrendLines.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(TrendLines_CollectionChanged); // Attach event handler on collection changed event with DataSeries collection Series.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Series_CollectionChanged); // Attach event handler on collection changed event with axisX collection (AxesX as AxisCollection).CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(AxesX_CollectionChanged); // Attach event handler on collection changed event with AxisY collection (AxesY as AxisCollection).CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(AxesY_CollectionChanged); }