I have a DataGrid that contains a number of Jobs. Each of these Jobs has an employee associated with it, and I would like to filter based on which Employees are on those jobs. So I have four CheckBoxes;
<CheckBox x:Name="employeeARad" Content="EmployeeA" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="18" Margin="7,0,0,5"/>
<CheckBox x:Name="employeeBRad" Content="EmployeeD" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="18" Margin="7,5,0,5"/>
<CheckBox x:Name="employeeCRad" Content="EmployeeC" HorizontalAlignment="Left" Margin="7,5,0,5" VerticalAlignment="Top" FontSize="18"/>
<CheckBox x:Name="employeeDRad" Content="EmployeeD" HorizontalAlignment="Left" Margin="7,5,0,5" VerticalAlignment="Top" FontSize="18"/>
I retrieve and fill an ObservableCollection of data from my Database. I then bind this collection to my DataGrid using: dataGrid.ItemsSource = _jobDataService.GetJobList();. As I stated before, each job has part of its model associated with an Employee. Here is the model for a Job;
class JobModel
{
public int CaseNumber { get; set; }
public string EmployeeName { get; set; }
public string CaseNotes { get; set; }
public DateTime DateCreated { get; set; }
public DateTime DateDeadline { get; set; }
public string CaseClient { get; set; }
}
My question really is how can I filter this collection that is bound to the DataGrid based upon the selection of CheckBoxes?
Aucun commentaire:
Enregistrer un commentaire