public MainWindowViewModel(ItemRepository itemRepository, IUserInteraction userInteraction) { _itemRepository = itemRepository; _userInteraction = userInteraction; Title = "This is a title"; LoadItemsCommand = new RelayCommand(_ => { var items = _itemRepository.GetItems(); // this returns the models! // we have to wrap them by a viewmodel var itemViewModels = items.Select(item => new ItemViewModel(item)); // no we wrapped them in a viewmodel Items.Clear(); foreach (var itemViewModel in itemViewModels) { Items.Add(itemViewModel); } }); ClearItemsCommand = new RelayCommand(_ => { const string title = "Items will be deleted"; const string prompt = "Are you shure that you want to delete the item?"; var result = _userInteraction.DisplayAlert(title, prompt); if (result == UserInteractionResult.OK || result == UserInteractionResult.Yes) { Items.Clear(); } }); }