Пример #1
0
        public static CollectionViewSourceBinding <TSource, TItem, TCell> Source <TSource, TItem, TCell>(this Binder <TSource, UICollectionView> binder, Expression <Func <TSource, IEnumerable <TItem> > > property, Action <TItem, int, TCell> prepareCell, ICommand select = null, bool fromNib = true, Action <float, float> onScroll = null)
            where TSource : class
            where TCell : UICollectionViewCell
        {
            var s = new BindableCollectionSource <TSource, TItem, UICollectionView, TCell>(binder.Source, property, binder.Target, (obj) => obj.ReloadData(), prepareCell, select);

            var result = new CollectionViewSourceBinding <TSource, TItem, TCell>(s, fromNib, onScroll);

            binder.Target.Source = result;
            return(result);
        }
        public CollectionViewSourceBinding(BindableCollectionSource <TOwner, TItem, UICollectionView, TCellView> source, bool fromNib, Action <float, float> onScroll = null)
        {
            this.source         = source;
            this.cellIdentifier = typeof(TCellView).Name;
            this.onScroll       = onScroll;

            var view = this.source.View;

            if (fromNib)
            {
                view.RegisterNibForCell(NibLocator <TCellView> .Nib, cellIdentifier);
            }
            else
            {
                view.RegisterClassForCell(typeof(TCellView), cellIdentifier);
            }
        }
Пример #3
0
        public TableViewSourceBinding(BindableCollectionSource <TOwner, TItem, UITableView, TCellView> source, Func <int, nfloat> heightForItem, bool fromNib, Action <float> onScroll = null)
        {
            this.source        = source;
            this.heightForItem = heightForItem;
            this.onScroll      = onScroll;

            var view = this.source.View;

            cellIdentifier = typeof(TCellView).Name;

            if (fromNib)
            {
                view.RegisterNibForCellReuse(NibLocator <TCellView> .Nib, cellIdentifier);
            }
            else
            {
                view.RegisterClassForCellReuse(typeof(TCellView), cellIdentifier);
            }
        }