Adding some new controls to the project
In this section, we are going to use two controls that are only available to Windows applications with WinUI. We are going to change the Save button to SplitButton
to allow users to save and return to a list of items, or save and continue adding another item to the item details page. Then, we will add a TeachingTip
control to inform users of the new saving capabilities. To follow along with these steps, you can use the starter project on GitHub (https://github.com/PacktPublishing/Learn-WinUI-3-Second-Edition/tree/master/Chapter05/Start). Let’s start by updating the Save button.
Using the SplitButton control
Follow these steps:
- First, in
ItemDetailsViewModel
, add a newSaveItemAndContinue
method to be bound to theClick
event of our newSplitButton
control:public void SaveItemAndContinue() { Save(); _itemId = 0; ItemName = string.Empty; ...