System.Windows.Data.ListCollectionView.ListCollectionView C# (CSharp) Method

ListCollectionView() public method

public ListCollectionView ( IList collection ) : System
collection IList
return System
		public ListCollectionView (IList collection)
			: base (collection)
		{
			var interfaces = SourceCollection.GetType ().GetInterfaces ();
			foreach (var t in interfaces) {
				if (t.IsGenericType && t.GetGenericTypeDefinition () == typeof (IList<>)) {
					Type type = t.GetGenericArguments () [0];
					ItemConstructor = type.GetConstructor (Type.EmptyTypes);
				}
			}

			UpdateCanAddNewAndRemove ();
			filteredList = new List <object> ();
			CurrentPosition = -1;
			IsEmpty = ActiveList.Count == 0;
			MoveCurrentToPosition (0);

			if (SourceCollection is INotifyCollectionChanged)
				((INotifyCollectionChanged) SourceCollection).CollectionChanged += HandleSourceCollectionChanged;

			GroupDescriptions.CollectionChanged += (o, e) => Refresh ();
			((INotifyCollectionChanged) SortDescriptions).CollectionChanged += (o, e) => {
				if (IsAddingNew || IsEditingItem)
					throw new InvalidOperationException ("Cannot modify SortDescriptions while adding or editing an item");
				Refresh ();
			};
		}