Now perform the following steps to add the search functionality attached to the grid records:
- Once the project has been created, add a new Employee model class inside the project and expose some properties, like we shared earlier in the Sorting data in a DataGrid control recipe.
- Create the same dependency property (Employees, of type ObservableCollection<Employee>) in the MainWindow.xaml.cs file and populate the collection with some data records.
- Now open the MainWindow.xaml file and add the attribute x:Name="window" to give the Window a name, so that we can perform element-to-element data binding.
- Replace the default Grid panel with a StackPanel.
- Now insert the following horizontal StackPanel, containing one TextBlock and one TextBox, inside the root StackPanel:
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="4 8"> <TextBlock Text="Filter records: "...