/// <summary> /// Handles the Removed event of the Area control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MetroControlBoxAreaCollectionEventArgs"/> instance containing the event data.</param> private void Area_Removed(object sender, MetroControlBoxAreaCollectionEventArgs e) { if (e.Item != null) { ZeroitMetroControlBox metroControlBox = this; e.Item.PropertyChanged -= new PropertyChangedEventHandler(metroControlBox.Item_PropertyChanged); this.RefreshAreas(); } }
/// <summary> /// Handles the Added event of the Area control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MetroControlBoxAreaCollectionEventArgs"/> instance containing the event data.</param> private void Area_Added(object sender, MetroControlBoxAreaCollectionEventArgs e) { if (e.Item != null) { ZeroitMetroControlBox metroControlBox = this; e.Item.PropertyChanged += new PropertyChangedEventHandler(metroControlBox.Item_PropertyChanged); } ZeroitMetroControlBox.AreaAddedEventHandler areaAddedEventHandler = this.AreaAdded; if (areaAddedEventHandler != null) { areaAddedEventHandler(this, new MetroControlBoxAreaCollectionEventArgs(e.Item)); } this.RefreshAreas(); }