Example #1
0
        private void SearchAndFilterWorkers()
        {
            if (WorkersListBox.ItemsSource == null && WorkerSearchTextBox.Text.Trim().ToLower() == string.Empty)
            {
                return;
            }

            var searchText   = WorkerSearchTextBox.Text.Trim().ToLower();
            var filteredView = ((DataView)WorkersListBox.ItemsSource).Table.AsEnumerable().Where(r => r.Field <bool>("AvailableInList")).
                               Where(r => r.Field <string>("Name").ToLower().Contains(searchText)).AsDataView();

            filteredView.Sort = "Name";

            WorkersListBox.ItemsSource = filteredView;

            WorkersListBox.UnselectAll();
        }
 public void RefreshView(object sender, PropertyChangedEventArgs e)
 {
     WorkersListBox.InvalidateArrange();
     WorkersListBox.UpdateLayout();
 }