MapSuiteGisEditor/GisEditorInfrastructure/Plugins/Styles/StyleLayerListItem.cs
/// <summary>
/// Handles the CollectionChanged event of the Items control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="NotifyCollectionChangedEventArgs" /> instance containing the event data.</param>
Handles the CollectionChanged event of the Items control.
Handles the CollectionChanged event of the Items control .
private void Items_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add && e.NewItems != null)
            {
                foreach (var item in e.NewItems.OfType<StyleLayerListItem>())
                {
                    item.Parent = this;
                    item.ConcreteObjectUpdated -= Item_UnderlieObjectUpdated;
                    item.ConcreteObjectUpdated += Item_UnderlieObjectUpdated;
                }
            }
            else if ((e.Action == NotifyCollectionChangedAction.Remove || e.Action == NotifyCollectionChangedAction.Reset) && e.OldItems != null)
            {
                foreach (var item in e.OldItems.OfType<StyleLayerListItem>())
                {
                    item.ConcreteObjectUpdated -= Item_UnderlieObjectUpdated;
                }
            }
        }
private void Items_CollectionChanged ( object sender , NotifyCollectionChangedEventArgs e ) { if ( e . Action == NotifyCollectionChangedAction . Add && e . NewItems != null ) { foreach ( var item in e . NewItems . OfType < StyleLayerListItem > ( ) ) { item . Parent = this ; item . ConcreteObjectUpdated -= Item_UnderlieObjectUpdated ; item . ConcreteObjectUpdated += Item_UnderlieObjectUpdated ; } } else if ( ( e . Action == NotifyCollectionChangedAction . Remove || e . Action == NotifyCollectionChangedAction . Reset ) && e . OldItems != null ) { foreach ( var item in e . OldItems . OfType < StyleLayerListItem > ( ) ) { item . ConcreteObjectUpdated -= Item_UnderlieObjectUpdated ; } } }
Handles the CollectionChanged event of the Items control.
Handles the CollectionChanged event of the Items control .
sender
object
The source of the event.
The source of the event .
e
NotifyCollectionChangedEventArgs
The  instance containing the event data.
The instance containing the event data .