public iOSViewSource(CollectionView.RenderedViews.CollectionView element, List <DataTemplate> dataTemplates) { _weakElement = new WeakReference <CollectionView.RenderedViews.CollectionView>(element); _createdCells = new Dictionary <long, WeakReference <iOSViewCell> >(); _dataTemplates = dataTemplates; var elementItemsSource = element.ItemsSource; _dataSource = elementItemsSource?.Cast <object>().ToList(); if (_dataSource == null) { return; } _multipleCellTemplates = element.ItemTemplate is DataTemplateSelector; if (!_multipleCellTemplates) { // Cache only support single DataTemplate _viewCellHolderCellHolderQueue = new UIViewCellHolderQueue( element.ViewCacheSize, () => CreateViewCellHolder()); _viewCellHolderCellHolderQueue.Build(); } }
public OnControlScrollChangedListener( CollectionViewRenderer nativeView, CollectionView.RenderedViews.CollectionView element) { _weakNativeView = new WeakReference <CollectionViewRenderer>(nativeView); _element = element; }
public RecycleViewAdapter(CollectionView.RenderedViews.CollectionView element, CollectionViewRenderer nativeView, RecyclerView parentView, Context context) { _element = element; _weakNativeView = new WeakReference <CollectionViewRenderer>(nativeView); _weakParentView = new WeakReference <RecyclerView>(parentView); _context = context; _elementItemsSource = element.ItemsSource; _dataSource = _elementItemsSource?.Cast <object>().ToList() ?? new List <object>(); _formsViews = new List <WeakReference <ViewCell> >(); if (_element.ItemTemplate is not DataTemplateSelector) { // Cache only support single DataTemplate _viewHolderQueue = new ViewHolderQueue(element.ViewCacheSize, () => CreateViewHolder()); _viewHolderQueue.Build(); } _notifyCollectionChanged = _elementItemsSource as INotifyCollectionChanged; if (_notifyCollectionChanged != null) { _notifyCollectionChanged.CollectionChanged += OnCollectionChanged; } }
public ResponsiveGridLayoutManager(Context context, CollectionView.RenderedViews.CollectionView element) : base(context, 1) { _context = context; _weakElement = new WeakReference <CollectionView.RenderedViews.CollectionView>(element); _spanNeedsCompute = true; }
public DragAnDropItemTouchHelperCallback(CollectionView.RenderedViews.CollectionView collection, RecycleViewAdapter recycleViewAdapter, ICommand onDragAndDropStart = null, ICommand onDragAndDropdEnded = null) { _collection = collection; _recycleViewAdapter = recycleViewAdapter; _onDragAndDropStart = onDragAndDropStart; _onDragAndDropdEnded = onDragAndDropdEnded; }
public void Initialize(ViewCell formsCell, UIView view, CollectionView.RenderedViews.CollectionView parent) { FormsCell = formsCell; // A previous view may have been added in a different data source ContentView.ViewWithTag(InnerViewTag)?.RemoveFromSuperview(); view.Tag = InnerViewTag; ContentView.AddSubview(view); }
public static int ComputeSpan(int availableWidth, CollectionView.RenderedViews.CollectionView element) { int itemSpace = PlatformHelper.Instance.DpToPixels(element.ItemSpacing); int leftPadding = PlatformHelper.Instance.DpToPixels(element.CollectionPadding.Left); int rightPadding = PlatformHelper.Instance.DpToPixels(element.CollectionPadding.Right); if (element.ItemWidth == 0) { element.ItemWidth = element.ComputeItemWidth(availableWidth); } int itemWidth = PlatformHelper.Instance.DpToPixels(element.ItemWidth, PlatformHelper.Rounding.Floor); int columnCount = 0; while (true) { columnCount++; int interPadding = itemSpace * (columnCount - 1); int totalWidth = itemWidth * columnCount + interPadding + leftPadding + rightPadding; if (totalWidth > availableWidth) { break; } } if (--columnCount == 0) { InternalLogger.Error( "The CollectionPadding, ItemSpacing and ItemWidth specified doesn't allow a single column to be displayed"); return(1); } return(columnCount); }
public void Bind(object dataContext, CollectionView.RenderedViews.CollectionView parent) { FormsCell.BindingContext = dataContext; FormsCell.Parent = parent; }
public void Bind(object context, CollectionView.RenderedViews.CollectionView parent) { _viewCell.BindingContext = context; _viewCell.Parent = parent; }