public static void TrySetSortDescription(this CompositeCollection compositeCollection, SortDescription sortDescription) { Contract.Requires(compositeCollection.IsNotNull()); var collectionViews = compositeCollection.ContainerCollectionsOfType <ICollectionView>().ToList(); if (!collectionViews.Any()) { throw new ArgumentException("CompositeCollection does not contains ICollectionView to set sort description"); } collectionViews.ForEach(item => item.UpdateSortDescriptions(sortDescription)); }