示例#1
0
        /// <summary>
        /// Claculates the id to give the user in the list
        /// all of the id's are the rows which the user is written
        /// </summary>
        /// <returns></returns>
        private int CalculateID()
        {
            int id = 1;

            UserList     = new ObservableCollection <User>(UserList.OrderBy(i => i));         //sort the list in order to place the new user in correct index
            UserListView = (ListCollectionView)CollectionViewSource.GetDefaultView(UserList); // refresh the collection view to allow sorting and filtering
            ListFilter.ResetFilter();

            for (int i = 0; i < UserList.Count; i++, id++)
            {
                if (id != UserList[i].ID)
                {
                    id = i + 1;
                    break;
                }
            }
            return(id);
        }
示例#2
0
 /// <summary>
 /// Clears any applied filters to the collection view object
 /// </summary>
 private void ClearFilter()
 {
     UserListView.Filter = null;
     ListFilter.ResetFilter();
 }