We will use the framework's SearchBoxViewModel control to filter the list of recipes by name. For a complete description of its behavior and public API, see Search Box.
Add a synchronized view field and the search box property to RecipePageViewModel:
Update the RecipePageViewModel constructor. The recipes will now be processed through a synchronized View and its attached filter, rather than exposing the raw list directly.
Update GetChildren to include the search component in the routing tree — SearchBoxViewModel is a regular view model, so its historical search text participates in Undo/Redo through the same tree.
public override IEnumerable<IViewModel> GetChildren()
{
yield return Search;
foreach (var recipe in _recipes)
{
yield return recipe;
}
}
Implement the UpdateRecipeList handler to apply the search filter.