Beispiel #1
0
 public static Binder <TSource, UITableView> Source <TSource, TSection, TItem, THeaderCell, TCell>(this Binder <TSource, UITableView> binder, Expression <Func <TSource, IEnumerable <IGrouping <TSection, TItem> > > > property, ICommand select = null, int heightForHeader = 44, int heightForItem = 44, bool fromNibs = true, Action <float> onScroll = null)
     where TSource : class
     where TCell : IView
     where THeaderCell : IView
 {
     return(binder.Source(property, (s, v, c) =>
     {
         c.RegisterCellView <TCell>("cell", heightForItem);
         c.RegisterHeaderView <THeaderCell>("header", heightForHeader);
     }, new RelayConverter <IEnumerable <IGrouping <TSection, TItem> >, CollectionSource <TSource> >((x) =>
     {
         var collection = new CollectionSource <TSource>(binder.Source);
         collection.WithSections((vm) =>
         {
             return x.Select(e =>
             {
                 var section = new Section <TSource>(collection);
                 section.WithHeader("header", vm2 => e.Key);
                 section.WithCells("cell", vm2 => e, select);
                 return section;
             });
         });
         return collection;
     }), fromNibs));
 }
Beispiel #2
0
 public static Binder <TSource, UITableView> Source <TSource, TItem, TCell>(this Binder <TSource, UITableView> binder, Expression <Func <TSource, IEnumerable <TItem> > > property, ICommand select = null, int heightForItem = 44, bool fromNibs = true, Action <float> onScroll = null)
     where TSource : class
     where TCell : IView
 {
     return(binder.Source(property, (s, v, c) =>
     {
         c.RegisterCellView <TCell>("cell", heightForItem);
     }, new RelayConverter <IEnumerable <TItem>, CollectionSource <TSource> >((x) =>
     {
         var collection = new CollectionSource <TSource>(binder.Source);
         collection.WithSection().WithCells("cell", (arg) => x, select);
         return collection;
     }), fromNibs));
 }
Beispiel #3
0
 public Section(CollectionSource <TViewModel> source)
 {
     this.source = source;
 }
 public RecyclerViewAdapterBinding(CollectionSource <TViewModel> datasource)
 {
     this.DataSource = datasource;
 }
Beispiel #5
0
 public CollectionViewSourceBinding(UICollectionView view, CollectionSource <TViewModel> datasource, bool fromNibs = true)
 {
     this.datasource = datasource;
     view.Delegate   = new Layout(datasource);
     this.RegisterCells(view, fromNibs);
 }
Beispiel #6
0
 public Layout(CollectionSource <TViewModel> datasource)
 {
     this.datasource = datasource;
 }
 public RecyclerViewAdapterBinding(CollectionSource <TViewModel> datasource)
 {
     this.datasource  = datasource;
     this.descriptors = datasource.CellViews.Union(datasource.HeaderViews).Union(datasource.FooterViews).ToList();
 }
Beispiel #8
0
 public TableViewSourceBinding(UITableView view, CollectionSource <TViewModel> datasource, bool fromNibs = true)
 {
     this.datasource = datasource;
     this.RegisterCells(view, fromNibs);
 }