コード例 #1
0
        private async Task RefreshAsync()
        {
            ViewModel.IsBusy = true;
            var jbms = new BeerListViewViewModel();
            var gba  = await jbms.GetBeersAsync();

            ViewModel.IsBusy     = false;
            listView.ItemsSource = gba;

            // configure the pull-to-refresh
            listView.IsPullToRefreshEnabled = true;
            listView.RefreshCommand         = ViewModel.LoadBeersCommand;
            listView.IsRefreshing           = ViewModel.IsBusy;
            listView.SetBinding(ListView.IsRefreshingProperty, "IsBusy");
            listView.SetBinding <BeerListViewViewModel>(ListView.IsRefreshingProperty, vm => vm.IsBusy, mode: BindingMode.OneWay);


            //var cell = new DataTemplate (typeof(TextCell));
            //use the two lines below if you want to use the default text property
            //cell.SetBinding(TextCell.TextProperty, "Name"); //the word Text here represents the field in the Database we want returned
            //listView.ItemTemplate = cell;
            //end two lines commentary

            listView.ItemTemplate = new DataTemplate(typeof(ListOfBeerCell2));              //this uses my customized cell to make 2 items in 1 row
        }
コード例 #2
0
		private async Task RefreshAsync()
		{
			ViewModel.IsBusy = true;
			var jbms = new BeerListViewViewModel();
			var gba = await jbms.GetBeersAsync();
			ViewModel.IsBusy = false;
			listView.ItemsSource = gba;

			// configure the pull-to-refresh
			listView.IsPullToRefreshEnabled = true;
			listView.RefreshCommand = ViewModel.LoadBeersCommand;
			listView.IsRefreshing = ViewModel.IsBusy;
			listView.SetBinding(ListView.IsRefreshingProperty, "IsBusy");
			listView.SetBinding<BeerListViewViewModel>(ListView.IsRefreshingProperty, vm => vm.IsBusy, mode: BindingMode.OneWay);


			//var cell = new DataTemplate (typeof(TextCell));
			//use the two lines below if you want to use the default text property
			//cell.SetBinding(TextCell.TextProperty, "Name"); //the word Text here represents the field in the Database we want returned
			//listView.ItemTemplate = cell;
			//end two lines commentary

			listView.ItemTemplate = new DataTemplate (typeof(ListOfBeerCell2)); //this uses my customized cell to make 2 items in 1 row


		}