In the last recipe of the current chapter, you will learn how to remove data from a particular table in the SQLite database.
As an example, you will introduce the last changes in the project from the previous recipe. You will do this by allowing a user to delete the currently selected entry.
To modify the preceding example by introducing the feature of deleting a currently selected entry, perform the following steps:
Add the
CmdDelete
property, representing the command, to theMainViewModel
class in theMainViewModel.cs
file:public ICommand CmdDelete { get; set; }
Modify the constructor of the
MainViewModel
class in theMainViewModel.cs
file as follows:public MainViewModel() { (...) CmdDelete = new RelayCommand(() => Delete()); }
Add the
Delete
private method, which removes the currently selected entry...