private async void BinSelected(BinViewModel bvm) { if (!ScaleMode) { BinView bv = rackview.GetBinView(bvm); if (bv is BinView) { await rackscrollview.ScrollToAsync(bv, ScrollToPosition.Center, true); } } }
/// <summary> /// For Autoscrolling /// </summary> /// <param name="bvm"></param> /// <returns></returns> public BinView GetBinView(BinViewModel bvm) { foreach (Xamarin.Forms.View view in grid.Children) { if (view is BinView) { BinView binview = (BinView)view; if (binview.Model == bvm) { return(binview); } } } return(null); }
private void FillBins() { for (int i = 1; i <= model.Levels; i++) { for (int j = 1; j <= model.Sections; j++) { BinViewModel finded = model.BinsViewModel.BinViewModels.Find(x => x.Level == i && x.Section == j); if (finded is BinViewModel) { try { BinView bev = new BinView(finded); grid.Children.Add(bev, finded.Section, finded.Section + finded.SectionSpan, finded.Level, finded.Level + finded.LevelSpan); } catch (Exception exp) { System.Diagnostics.Debug.WriteLine(exp.Message); } } } } }