using inutralia.ViewModels;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace inutralia.Views
{
    
    public partial class ModalFiltersRecipe : ContentPage
    {
        protected RecipeListOptionsViewModel ViewModel => BindingContext as RecipeListOptionsViewModel;

        protected RecipeListView ListView;
       
        public ModalFiltersRecipe( RecipeListView listView)
        {
            InitializeComponent();

            ListView = listView;
        }

        void ItemTapped(object sender, ItemTappedEventArgs e)
        {                          
            ((ListView)sender).SelectedItem = null;
        }

        private async void ApplyModalButton(object sender, EventArgs e)
        {
            await ListView.ApplyFilters ();
        }

        protected override async void OnAppearing()
        {
            base.OnAppearing();

            await ViewModel.ExecuteLoadOptionsCommand();
        }
    }
}
