Add Method
We want to be able to add items to and remove items from the collection.
In the next step, we'll add a TextBox and a Button to let the user add new To-Do items.
<dot:TextBox Text="{value: NewItem}" />
<dot:Button Click="{command: Add()}"
Text="Add Item" />
However, we need to do something else first.
Tasks
Let's write the adding logic first.
- Add a
stringproperty calledNewItemto the ViewModel. - Inside the
Addmethod, create a newToDoItemobject and initialize itsTextproperty toNewItem. Then add the instance toItems.
| Message | Line | Column | |
|---|---|---|---|
|
|