Winify – Rev

Subversion Repositories:
Rev:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;

namespace Announcements
{
    /// <summary>
    ///     A binding list with collection changed notifications.
    /// </summary>
    /// <typeparam name="T">a generic type</typeparam>
    /// <remarks>https://stackoverflow.com/questions/23339233/get-deleted-item-in-itemchanging-event-of-bindinglist</remarks>
    public class BindingListWithCollectionChanged<T> : BindingList<T>
    {
        #region Public Events & Delegates

        public event EventHandler<NotifyCollectionChangedEventArgs> CollectionChanged;

        #endregion

        #region Constructors, Destructors and Finalizers

        public BindingListWithCollectionChanged(IEnumerable<T> list) : this(new ObservableCollection<T>(list))
        {
        }

        private BindingListWithCollectionChanged(ObservableCollection<T> observableCollection) : base(
            observableCollection)
        {
            observableCollection.CollectionChanged += (sender, args) => CollectionChanged?.Invoke(sender, args);
        }

        public BindingListWithCollectionChanged() : this(new ObservableCollection<T>())
        {
        }

        #endregion
    }
}

Generated by GNU Enscript 1.6.5.90.