Winify – Blame information for rev 7
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
7 | office | 1 | using System; |
2 | using System.Collections.Generic; |
||
3 | using System.Collections.ObjectModel; |
||
4 | using System.Collections.Specialized; |
||
5 | using System.ComponentModel; |
||
6 | |||
7 | namespace Servers |
||
8 | { |
||
9 | /// <summary> |
||
10 | /// A binding list with collection changed notifications. |
||
11 | /// </summary> |
||
12 | /// <typeparam name="T">a generic type</typeparam> |
||
13 | /// <remarks>https://stackoverflow.com/questions/23339233/get-deleted-item-in-itemchanging-event-of-bindinglist</remarks> |
||
14 | public class BindingListWithCollectionChanged<T> : BindingList<T> |
||
15 | { |
||
16 | #region Public Events & Delegates |
||
17 | |||
18 | public event EventHandler<NotifyCollectionChangedEventArgs> CollectionChanged; |
||
19 | |||
20 | #endregion |
||
21 | |||
22 | #region Constructors, Destructors and Finalizers |
||
23 | |||
24 | public BindingListWithCollectionChanged(IEnumerable<T> list) : this(new ObservableCollection<T>(list)) |
||
25 | { |
||
26 | } |
||
27 | |||
28 | private BindingListWithCollectionChanged(ObservableCollection<T> observableCollection) : base( |
||
29 | observableCollection) |
||
30 | { |
||
31 | observableCollection.CollectionChanged += (sender, args) => CollectionChanged?.Invoke(sender, args); |
||
32 | } |
||
33 | |||
34 | public BindingListWithCollectionChanged() : this(new ObservableCollection<T>()) |
||
35 | { |
||
36 | } |
||
37 | |||
38 | #endregion |
||
39 | } |
||
40 | } |