示例#1
0
        public void RemoveRange(IEnumerable <string> itemIds)
        {
            List <string> removed = new List <string>();

            foreach (string id in itemIds)
            {
                if (Remove(id, false))
                {
                    removed.Add(id);
                }
            }
            if (removed.Count > 0)
            {
                SelectionCollectionRemoveEventArgs args =
                    new SelectionCollectionRemoveEventArgs(removed);
                CollectionChangeRemoved?.Invoke(this, args);
            }
        }
示例#2
0
 private bool Remove(string id, bool sendEvent)
 {
     if (allItems.Any(x => x.Id.Equals(id)))
     {
         allItems.Remove(allItems.First(x => x.Id.Equals(id)));
         if (sendEvent)
         {
             SelectionCollectionRemoveEventArgs args =
                 new SelectionCollectionRemoveEventArgs(new List <string>()
             {
                 id
             });
             CollectionChangeRemoved?.Invoke(this, args);
         }
         return(true);
     }
     return(false);
 }