Perform the following to create a data model, populate it, and bind it to a DataGrid in the UI. Later, add a CheckBox control to customize the sorting functionality:
- To begin, right-click on the Solution Explorer, create a new class file named Employee.cs, by following the right-click context menu entry Add | Class..., and add a few properties in it:
public class Employee { public string ID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string Department { get; set; } }
- Open the MainWindow.xaml.cs file and add a dependency property, Employees, of type ObservableCollection<Employee>. Make sure you add the following namespaces, System.Collections.ObjectModel and System.ComponentModel, in order to resolve the required classes:
public ObservableCollection<Employee> Employees { get { return (ObservableCollection<Employee>) GetValue(EmployeesProperty); } set { SetValue(EmployeesProperty...