/// <summary>
 /// Default constuctor
 /// </summary>
 /// <param name="selectionCollection">Model selection collection containing list items</param>
 protected SelectionCollectionViewModel(ISelectionCollection <T> selectionCollection)
 {
     collection = selectionCollection;
     collection.CollectionChangeAdded   += OnCollectionChangeAdded;
     collection.CollectionChangeRemoved += OnCollectionChangeRemoved;
     collection.CollectionChangeCleared += OnCollectionChangeCleared;
     allItems          = new ObservableCollection <TViewModel>();
     AllItems          = new ListCollectionView(allItems);
     commandGroupsList = CreateCommandGroups();
     CommandGroups     = new ReadOnlyCollection <CommandGroupViewModel>(commandGroupsList);
     ShowIdColumn      = false;
 }
        /// <summary>
        /// Default constuctor
        /// </summary>
        /// <param name="selectionCollection">Model selection collection containing list items</param>
        public SelectionCollectionViewModel(ISelectionCollection <T> selectionCollection)
        {
            collection = selectionCollection ?? throw new ArgumentNullException(nameof(selectionCollection) + " can not be null");
            collection.CollectionChangeAdded   += OnCollectionChangeAdded;
            collection.CollectionChangeRemoved += OnCollectionChangeRemoved;
            collection.CollectionChangeCleared += OnCollectionChangeCleared;
            allItems          = new ObservableCollection <TViewModel>();
            AllItems          = new ListCollectionView(allItems);
            commandGroupsList = CreateCommandGroups();
            CommandGroups     = new ReadOnlyCollection <CommandGroupViewModel>(commandGroupsList);

            ShowIdColumn            = false;
            DisplayTextColumnHeader = "Item";
        }
 public static void SetItemsSource(ListBox obj, ISelectionCollection value) => obj.SetValue(ItemsSourceProperty, value);