public PhotosListPage(int inspectionId) { _inspectionId = inspectionId; _viewModel = new PhotosListViewModel(inspectionId); BindingContext = _viewModel; Title = "Photos"; }
public PhotosListPage(int inspectionId) { _inspectionId = inspectionId; _viewModel = new PhotosListViewModel(inspectionId); BindingContext = _viewModel; _photosListView = new ListView { ItemTemplate = new DataTemplate(typeof(PhotoListImageCell)), IsPullToRefreshEnabled = true }; _photosListView.SetBinding(ListView.RefreshCommandProperty, nameof(_viewModel.RefreshCommand)); _photosListView.SetBinding(ListView.ItemsSourceProperty, nameof(_viewModel.VisiblePhotoModelList)); _photosListView.ItemSelected += (sender, e) => _photosListView.SelectedItem = null; _addPhotoToolbarItem = new ToolbarItem(); switch (Device.RuntimePlatform) { case Device.iOS: case Device.Android: _addPhotoToolbarItem.Icon = "Add"; break; case Device.Windows: _addPhotoToolbarItem.Icon = "Assets/Add.png"; break; default: throw new Exception("Runtime Platform Not Supported"); } ToolbarItems.Add(_addPhotoToolbarItem); Title = "Photos"; Content = _photosListView; }