public ExpenseListPage()
        {
            InitializeComponent();

            this.BindingContext = viewModel = new ExpensesViewModel();

            AddItem.Command = new Command(() => {
                var detailPage = new DetailsPage(null);
                Navigation.PushAsync(detailPage);
            });


            ExpenseList.ItemTapped += (sender, args) =>
            {
                if (ExpenseList.SelectedItem == null)
                {
                    return;
                }

                var detailPage = new DetailsPage(args.Item as TripExpense);
                Navigation.PushAsync(detailPage);

                ExpenseList.SelectedItem = null;
            };
        }
        public ExpenseListPage()
        {
            InitializeComponent();

            this.BindingContext = viewModel = new ExpensesViewModel();

            ToolbarItems.Add(new ToolbarItem
            {
                Name    = "refresh",
                Icon    = "refresh.png",
                Command = viewModel.LoadExpenses
            });

            ExpenseList.ItemTapped += (sender, args) =>
            {
                if (ExpenseList.SelectedItem == null)
                {
                    return;
                }

                var detailPage = new DetailsPage(args.Item as TripExpense);
                Navigation.PushAsync(detailPage);

                ExpenseList.SelectedItem = null;
            };

            ButtonNewExpense.Clicked += async(sender, args) =>
            {
                var detailPage = new DetailsPage(null);
                await Navigation.PushAsync(detailPage);
            };
        }
		public ExpenseListPage()
		{
			InitializeComponent();

			this.BindingContext = viewModel = new ExpensesViewModel();

			AddItem.Command = new Command (() => {
				var detailPage = new DetailsPage (null);
				Navigation.PushAsync (detailPage);
			});


			ExpenseList.ItemTapped += (sender, args) =>
			{
				if (ExpenseList.SelectedItem == null)
					return;

				var detailPage = new DetailsPage(args.Item as TripExpense);
				Navigation.PushAsync(detailPage);

				ExpenseList.SelectedItem = null;
			};
				

		}
        public ExpensesPage()
        {
            this.Title = "Expenses";
            ViewModel  = new ExpensesViewModel();

            ToolbarItems.Add(new ToolbarItem
            {
                Icon    = "refresh.png",
                Command = ViewModel.LoadExpenses,
                Name    = "refresh"
            });

            var list = new ListView();

            list.ItemsSource = ViewModel.Expenses;

            var cell = new DataTemplate(typeof(TextCell));

            cell.SetBinding(TextCell.TextProperty, "Name");
            cell.SetBinding(TextCell.DetailProperty, "Price");

            list.ItemTemplate = cell;

            list.ItemTapped += (sender, args) =>
            {
                if (list.SelectedItem == null)
                {
                    return;
                }

                var detailPage = new DetailsPage(args.Item as TripExpense);
                Navigation.PushAsync(detailPage);

                list.SelectedItem = null;
            };


            var newExpense = new Button
            {
                Text = "New Expense"
            };

            newExpense.Clicked += async(sender, args) =>
            {
                var detailPage = new DetailsPage(null);
                await Navigation.PushAsync(detailPage);
            };

            var progress = new ActivityIndicator();

            progress.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");
            progress.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");


            Content = new StackLayout
            {
                Spacing  = 10,
                Padding  = 10,
                Children = { progress, list, newExpense }
            };
        }