From the course: Extending Xamarin with Behaviors, Commands, and Triggers
Unlock this course with a free trial
Join today to access over 22,400 courses taught by industry experts.
Refresh your ListView using commands - Xamarin Tutorial
From the course: Extending Xamarin with Behaviors, Commands, and Triggers
Refresh your ListView using commands
- [Narrator] Let's add a trigger to our refresh button, that allows us to refresh our to-do list. In order to do that we're going to out view model first. This is our to-do list page, so we're going to go to our to-do list view model, and we're going to add a new command. So public ICommand CleanAndRefresh And we are going to set this in our controller. So we're going to go back to our controller, and before we set that into view model, we're going to create a public async Task, and we're going to name it CleanAndRefresh. Now we're going to go back up to our on controller initialization method, and we are going to set this method as a call back, for a CleanAndRefresh ICommand. So view model.CleanAndRefresh. Goes new_Command and we are going to create an async method that calls our CleanAndRefresh method. Now let's add some functionality to that. Let's go ahead and access our view model, and we are just going to get our to-do list, and just create a complete new list. That takes the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.