Exemplo n.º 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));
 }
Exemplo n.º 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));
 }