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 }
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 }
public async Task CallMongoDatabaseAsync() { var jbms = new BeerListViewViewModel(); ViewModel.IsBusy = true; var gba = await jbms.GetOnTapBeersAsync(); ViewModel.IsBusy = false; lv.ItemsSource = gba; // configure the pull-to-refresh lv.IsPullToRefreshEnabled = true; lv.RefreshCommand = ViewModel.LoadBeersCommand; lv.IsRefreshing = ViewModel.IsBusy; lv.SetBinding(ListView.IsRefreshingProperty, "IsBusy"); lv.SetBinding<BeerListViewViewModel>(ListView.IsRefreshingProperty, vm => vm.IsBusy, mode: BindingMode.OneWay); }
public async Task CallMongoDatabaseAsync() { var jbms = new BeerListViewViewModel(); ViewModel.IsBusy = true; var gba = await jbms.GetOnTapBeersAsync(); ViewModel.IsBusy = false; lv.ItemsSource = gba; // configure the pull-to-refresh lv.IsPullToRefreshEnabled = true; lv.RefreshCommand = ViewModel.LoadBeersCommand; lv.IsRefreshing = ViewModel.IsBusy; lv.SetBinding(ListView.IsRefreshingProperty, "IsBusy"); lv.SetBinding <BeerListViewViewModel>(ListView.IsRefreshingProperty, vm => vm.IsBusy, mode: BindingMode.OneWay); }
private async Task RefreshAsync() { var staffSvc = new BeerListViewViewModel(); var currStaff = await staffSvc.GetAllStaffAsync(); mcp.Title = "Our Team"; mcp.Icon = "Contacts-30.png"; foreach (var s in currStaff.staffs) { var jbt = new JBTeam () { Name = s.Name, Title = s.Title, Desc = s.Desc, PicURL = s.PicURL }; mcp.Children.Add (new MeetOurFolks(jbt)); } }
public FoodTruckList () { ViewModel = new BeerListViewViewModel { }; // Set the binding context to the newly created ViewModel BindingContext = ViewModel; Title = "Food Truck Schedule"; lv = new ListView ( // IsPullToRefreshEnabled = true, // RefreshCommand = {Binding IsBusy, Mode=OneWay}, // IsRefreshing = "" ); //var cell = new DataTemplate (typeof(TextCell)); //use the two lines below if you want to use the default text property //cell.SetBinding(TextCell.TextProperty, "summary"); //the word Text here represents the field in the Database we want returned //lv.ItemTemplate = cell; //end two lines commentary lv.ItemTemplate = new DataTemplate (typeof(JBEventCell)); lv.ItemSelected += (sender, e) => { Navigation.PushAsync(new EventDetails(e.SelectedItem as JBEvent.Item)); }; Content = new StackLayout { Padding = new Thickness (0, Device.OnPlatform (0, 0, 0), 0, 0), Spacing = 3, Orientation = StackOrientation.Vertical, Children = { lv } }; }
public BeerListView () { // you need a view model to bind to // setup your ViewModel ViewModel = new BeerListViewViewModel { }; // Set the binding context to the newly created ViewModel BindingContext = ViewModel; listView = new ListView { // HasUnevenRows = true }; //need to add a Details Push Event on the ITemSelected here when working done listView.ItemSelected += (sender, e) => { Navigation.PushAsync(new BeerDetail(e.SelectedItem as Beer)); }; var activityIndicator = new ActivityIndicator { Color = Color.Black, }; activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy"); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); this.Title = "All our Beers on Tap"; this.Content = new StackLayout { Padding = new Thickness (0, Device.OnPlatform (0, 0, 0), 0, 0), Spacing = 3, Orientation = StackOrientation.Vertical, Children = { activityIndicator,listView } }; }
private async Task RefreshAsync() { var staffSvc = new BeerListViewViewModel(); var currStaff = await staffSvc.GetAllStaffAsync(); mcp.Title = "Our Team"; mcp.Icon = "Contacts-30.png"; foreach (var s in currStaff.staffs) { var jbt = new JBTeam() { Name = s.Name, Title = s.Title, Desc = s.Desc, PicURL = s.PicURL }; mcp.Children.Add(new MeetOurFolks(jbt)); } }
public BeerListView() { // you need a view model to bind to // setup your ViewModel ViewModel = new BeerListViewViewModel { }; // Set the binding context to the newly created ViewModel BindingContext = ViewModel; listView = new ListView { // HasUnevenRows = true }; //need to add a Details Push Event on the ITemSelected here when working done listView.ItemSelected += (sender, e) => { Navigation.PushAsync(new BeerDetail(e.SelectedItem as Beer)); }; var activityIndicator = new ActivityIndicator { Color = Color.Black, }; activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy"); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); this.Title = "All our Beers on Tap"; this.Content = new StackLayout { Padding = new Thickness(0, Device.OnPlatform(0, 0, 0), 0, 0), Spacing = 3, Orientation = StackOrientation.Vertical, Children = { activityIndicator, listView } }; }
public FoodTruckList() { ViewModel = new BeerListViewViewModel { }; // Set the binding context to the newly created ViewModel BindingContext = ViewModel; Title = "Food Truck Schedule"; lv = new ListView( // IsPullToRefreshEnabled = true, // RefreshCommand = {Binding IsBusy, Mode=OneWay}, // IsRefreshing = "" ); //var cell = new DataTemplate (typeof(TextCell)); //use the two lines below if you want to use the default text property //cell.SetBinding(TextCell.TextProperty, "summary"); //the word Text here represents the field in the Database we want returned //lv.ItemTemplate = cell; //end two lines commentary lv.ItemTemplate = new DataTemplate(typeof(JBEventCell)); lv.ItemSelected += (sender, e) => { Navigation.PushAsync(new EventDetails(e.SelectedItem as JBEvent.Item)); }; Content = new StackLayout { Padding = new Thickness(0, Device.OnPlatform(0, 0, 0), 0, 0), Spacing = 3, Orientation = StackOrientation.Vertical, Children = { lv } }; }
public WhatsOnTapPage () { ViewModel = new BeerListViewViewModel { }; // Set the binding context to the newly created ViewModel BindingContext = ViewModel; Title = "Whats On Tap Today"; lv = new ListView (); lv.ItemTemplate = new DataTemplate (typeof(ListOfBeerCell2)); lv.ItemSelected += (sender, e) => { Navigation.PushAsync(new BeerDetail(e.SelectedItem as Beer)); }; var activityIndicator = new ActivityIndicator { Color = Color.Black, }; activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy"); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); Content = new StackLayout { Padding = new Thickness (0, Device.OnPlatform (0, 0, 0), 0, 0), Spacing = 3, Orientation = StackOrientation.Vertical, Children = { activityIndicator,lv } }; }
public WhatsOnTapPage() { ViewModel = new BeerListViewViewModel { }; // Set the binding context to the newly created ViewModel BindingContext = ViewModel; Title = "Whats On Tap Today"; lv = new ListView(); lv.ItemTemplate = new DataTemplate(typeof(ListOfBeerCell2)); lv.ItemSelected += (sender, e) => { Navigation.PushAsync(new BeerDetail(e.SelectedItem as Beer)); }; var activityIndicator = new ActivityIndicator { Color = Color.Black, }; activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy"); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); Content = new StackLayout { Padding = new Thickness(0, Device.OnPlatform(0, 0, 0), 0, 0), Spacing = 3, Orientation = StackOrientation.Vertical, Children = { activityIndicator, lv } }; }