Last active
          March 30, 2020 19:36 
        
      - 
      
- 
        Save jfversluis/12d166a400f18688e523430258d70a15 to your computer and use it in GitHub Desktop. 
    View model for our main page
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | using System.Collections.ObjectModel; | |
| using Xamarin.Forms; | |
| namespace DataBindingScopeSample | |
| { | |
| public class ListModel | |
| { | |
| public string Title { get; set; } | |
| public string Image { get; set; } | |
| } | |
| public class MainPageViewModel | |
| { | |
| public ObservableCollection<ListModel> MyItems { get; set; } = new ObservableCollection<ListModel> | |
| { | |
| // List filling here | |
| }; | |
| public Command<ListModel> DeleteCommand { get; private set; } | |
| public MainPageViewModel() | |
| { | |
| DeleteCommand = new Command<ListModel>(model => | |
| { | |
| MyItems.Remove(model); | |
| }); | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment