public void RecycleCell(object data, DataTemplate dataTemplate, VisualElement parent) { if (_viewCell == null) { _viewCell = (dataTemplate.CreateContent() as FastGridCell); _viewCell.BindingContext = data; _viewCell.Parent = parent; _viewCell.PrepareCell(new Size(Bounds.Width, Bounds.Height)); _originalBindingContext = _viewCell.BindingContext; var renderer = RendererFactory.GetRenderer(_viewCell.View); _view = renderer.NativeView; _view.AutoresizingMask = UIViewAutoresizing.All; _view.ContentMode = UIViewContentMode.ScaleToFill; ContentView.AddSubview(_view); return; } else if (data == _originalBindingContext) { _viewCell.BindingContext = _originalBindingContext; } else { _viewCell.BindingContext = data; } }
public void RecycleCell (Android.Views.View view, FastGridCell newCell) { if (CellItemsByCoreCells.ContainsKey (view)) { var reusedItem = CellItemsByCoreCells [view]; if (OriginalBindingContextsForReusedItems.ContainsKey (newCell)) { reusedItem.BindingContext = OriginalBindingContextsForReusedItems [newCell]; } else { reusedItem.BindingContext = newCell.BindingContext; } } }
public GridViewCellContainer(Context context, FastGridCell fastGridCell, global::Android.Views.View parent, Size initialCellSize) : base(context) { using (var h = new Handler(Looper.MainLooper)) { h.Post(() => { _viewCell = fastGridCell; fastGridCell.PrepareCell(initialCellSize); // _viewCell.View.BackgroundColor = Xamarin.Forms.Color.Green; var renderer = RendererHelper.GetOrCreateRenderer(fastGridCell.View); _nativeView = renderer.ViewGroup; // SetBackgroundColor (Android.Graphics.Color.Yellow); AddView(_nativeView); }); } }
public GridViewCellContainer (Context context, FastGridCell fastGridCell, global::Android.Views.View parent, Size initialCellSize) : base (context) { using (var h = new Handler (Looper.MainLooper)) { h.Post (() => { _parent = parent; _viewCell = fastGridCell; fastGridCell.PrepareCell (initialCellSize); // _viewCell.View.BackgroundColor = Xamarin.Forms.Color.Green; var renderer = fastGridCell.View.GetOrCreateRenderer (); _nativeView = renderer.ViewGroup; // SetBackgroundColor (Android.Graphics.Color.Yellow); AddView (_nativeView); }); } }
public void RecycleCell (object data, DataTemplate dataTemplate, VisualElement parent) { if (_viewCell == null) { _viewCell = (dataTemplate.CreateContent () as FastGridCell); _viewCell.BindingContext = data; _viewCell.Parent = parent; _viewCell.PrepareCell (new Size (Bounds.Width, Bounds.Height)); _originalBindingContext = _viewCell.BindingContext; var renderer = RendererFactory.GetRenderer (_viewCell.View); _view = renderer.NativeView; _view.AutoresizingMask = UIViewAutoresizing.All; _view.ContentMode = UIViewContentMode.ScaleToFill; ContentView.AddSubview (_view); return; } else if (data == _originalBindingContext) { _viewCell.BindingContext = _originalBindingContext; } else { _viewCell.BindingContext = data; } }
public void CacheCell (FastGridCell cell, Android.Views.View view) { CellItemsByCoreCells [view] = cell; OriginalBindingContextsForReusedItems [cell] = cell.BindingContext; }
void CacheBindingContextForReusedCell (FastGridCell cell) { OriginalBindingContextsForReusedItems [cell] = cell.BindingContext; }
public object GetBindingContextForReusedCell (FastGridCell cell) { if (OriginalBindingContextsForReusedItems.ContainsKey (cell)) { return OriginalBindingContextsForReusedItems [cell]; } else { return null; } }