using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

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

namespace XamarinStudy.Views
{
	[XamlCompilation(XamlCompilationOptions.Compile)]
	public partial class SampleFlyoutPageFlyout : ContentPage
	{
		public ListView ListView;

		public SampleFlyoutPageFlyout()
		{
			InitializeComponent();

			BindingContext = new SampleFlyoutPageFlyoutViewModel();
			ListView = MenuItemsListView;
		}

		private class SampleFlyoutPageFlyoutViewModel : INotifyPropertyChanged
		{
			public ObservableCollection<SampleFlyoutPageFlyoutMenuItem> MenuItems { get; set; }

			public SampleFlyoutPageFlyoutViewModel()
			{
				MenuItems = new ObservableCollection<SampleFlyoutPageFlyoutMenuItem>(new[]
				{
					new SampleFlyoutPageFlyoutMenuItem { Id = 0, Title = "Page 1" },
					new SampleFlyoutPageFlyoutMenuItem { Id = 1, Title = "Page 2" },
					new SampleFlyoutPageFlyoutMenuItem { Id = 2, Title = "Page 3" },
					new SampleFlyoutPageFlyoutMenuItem { Id = 3, Title = "Page 4" },
					new SampleFlyoutPageFlyoutMenuItem { Id = 4, Title = "Page 5" },
				});
			}

			#region INotifyPropertyChanged Implementation
			public event PropertyChangedEventHandler PropertyChanged;
			void OnPropertyChanged([CallerMemberName] string propertyName = "")
			{
				if (PropertyChanged == null)
					return;

				PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
			}
			#endregion
		}
	}
}