예제 #1
0
        public UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            var section = Sections[indexPath.Section];

            switch (section.Type)
            {
            case ImagePickerSection.CellType.SelectableImage:
            {
                using (var headerKind = new NSString("UICollectionElementKindSectionHeader"))
                {
                    if (elementKind.Equals(headerKind) && section.Type == ImagePickerSection.CellType.SelectableImage)
                    {
                        var headerView = collectionView.DequeueReusableSupplementaryView(elementKind, SelectableDateCollectionHeaderView.Identifier, indexPath) as SelectableDateCollectionHeaderView;
                        headerView.UpdateHeader(section.Date, section.Selected);
                        headerView.AddGestureRecognizer(CreateHeaderTapGesture());
                        return(headerView);
                    }
                }
                break;
            }

            case ImagePickerSection.CellType.TakePhoto:
                return(collectionView.DequeueReusableSupplementaryView(elementKind, headerId, indexPath));
            }
            return(null);
        }
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            if (elementKind == (NSString)"UICollectionElementKindSectionHeader") {
                PictureHeaderVIew header = (PictureHeaderVIew)collectionView.DequeueReusableSupplementaryView
                    (UICollectionElementKindSection.Header, (NSString)"header", indexPath);
                header.title.Frame = new RectangleF (20, 15, 230, 300);
                header.title.Text = Items.Title;
                header.title.Lines = 0;
                header.title.SizeToFit ();
                header.photo.Image = UIImage.FromFile ("./Assets/photo.png");
                header.picturesCount.Text = Items.Images.Count.ToString();

                return header;
            }
            else {
                StartReadingView footer = (StartReadingView)collectionView.DequeueReusableSupplementaryView
                    (UICollectionElementKindSection.Footer, (NSString)"collectionfooter", indexPath);
                footer.StartReading.SetBackgroundImage (UIImage.FromFile ("./Assets/buttonlong.png"), UIControlState.Normal);
                footer.StartReading.TouchUpInside += (object sender, EventArgs e) => {
                    UIStoryboard board = UIStoryboard.FromName ("MainStoryboard", null);
                    var prefs = (PreferencesSubController)board.InstantiateViewController ("preferencessub");
                    this.NavigationController.PushViewController(prefs, true);
                };
                return footer;
            }
        }
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement started");

            if (elementKind == UICollectionElementKindSectionKey.Header && !HeaderReuseID.IsNullOrEmtpy())
            {
                mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement HEADER resolving started");

                if (_headerDataContext != null)
                {
                    var headerView = collectionView.DequeueReusableSupplementaryView(elementKind, HeaderReuseID, indexPath);
                    mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement HEADER in process");
                    SetupReusableView(headerView, elementKind, indexPath, _headerDataContext);
                    return(headerView);
                }

                mvxLog.Warn("SupplementaryCollectionViewSource GetViewForSupplementaryElement _headerDataContext is NULL");

                mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement HEADER resolving ended");
            }
            else
            {
                mvxLog.Warn("SupplementaryCollectionViewSource GetViewForSupplementaryElement HEADER ID NULL");
            }

            if (elementKind == UICollectionElementKindSectionKey.Footer && !FooterReuseID.IsNullOrEmtpy())
            {
                mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement FOOTER resolving started");

                if (_footerDataContext != null)
                {
                    var footerView = collectionView.DequeueReusableSupplementaryView(elementKind, FooterReuseID, indexPath);
                    mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement FOOTER in process");
                    SetupReusableView(footerView, elementKind, indexPath, _headerDataContext);
                    return(footerView);
                }

                mvxLog.Warn("SupplementaryCollectionViewSource GetViewForSupplementaryElement _footerDataContext is NULL");

                mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement FOOTER resolving ended");
            }
            else
            {
                mvxLog.Warn("SupplementaryCollectionViewSource GetViewForSupplementaryElement FOOTER ID NULL");
            }

            mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement ended");

            return(null);
        }
예제 #4
0
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            var section = datasource.Sections.ElementAt(indexPath.Section);
            var item    = (elementKind == UICollectionElementKindSectionKey.Header) ? section.Header : section.Footer;

            if (item == null)
            {
                return(collectionView.DequeueReusableSupplementaryView(elementKind, "___empty___", indexPath));
            }

            var view = collectionView.DequeueReusableSupplementaryView(elementKind, item.ViewIdentifier, indexPath) as IView;

            view.ViewModel = item.Item;
            return(view as UICollectionReusableView);
        }
예제 #5
0
        private UICollectionReusableView GetBindableSupplementaryView(
            UICollectionView collectionView,
            NSString elementKind,
            NSIndexPath indexPath,
            NSString reuseIdentifier,
            object context,
            DataTemplate template,
            Style style)
        {
            var supplementaryView = (ListViewBaseInternalContainer)collectionView.DequeueReusableSupplementaryView(
                elementKind,
                reuseIdentifier,
                indexPath);

            using (supplementaryView.InterceptSetNeedsLayout())
            {
                if (supplementaryView.Content == null)
                {
                    supplementaryView.Owner = Owner;
                    var content = CreateContainerForElementKind(elementKind);
                    content.HorizontalContentAlignment = HorizontalAlignment.Stretch;
                    content.VerticalContentAlignment   = VerticalAlignment.Stretch;
                    supplementaryView.Content          = content
                                                         .Binding("Content", "");
                }
                supplementaryView.Content.ContentTemplate = template;
                supplementaryView.Content.DataContext     = context;
                if (style != null)
                {
                    supplementaryView.Content.Style = style;
                }
            }

            return(supplementaryView);
        }
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            var header = (TagsHeader)collectionView.DequeueReusableSupplementaryView(UICollectionElementKindSection.Header, tagsHeaderReuseId, indexPath);

            header.TitleLabel.Text = "Character Tags";
            return(header);
        }
 public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
 {
     if (indexPath.Section == 0)
     {
         Header = (CardsContainerHeader)collectionView.DequeueReusableSupplementaryView(UICollectionElementKindSection.Header, nameof(CardsContainerHeader), indexPath);
         Header.NavigationController = _controller;
         Header.Presenter            = _presenter;
         return(Header);
     }
     else
     {
         var header = (TransactionHeaderCollectionViewCell)collectionView.DequeueReusableSupplementaryView(UICollectionElementKindSection.Header, nameof(TransactionHeaderCollectionViewCell), indexPath);
         header.Update(GroupedHistory[indexPath.Section - 1].ElementAt(indexPath.Row).DateTime, indexPath.Section == 1 && indexPath.Row == 0);
         return(header);
     }
 }
        public UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            var header = (NotesCollectionViewHeader)collectionView.DequeueReusableSupplementaryView(elementKind, NotesCollectionViewHeader.HeaderID, indexPath);

            header.Text = "Notes";
            return(header);
        }
        protected virtual ContentCellContainer GetNativeHeaderCell(NSIndexPath indexPath)
        {
            var cell = TemplatedItemsView.TemplatedItems[(int)indexPath.Section] as ContentCell;

            var renderer = (ContentCellRenderer)Xamarin.Forms.Internals.Registrar.Registered.GetHandlerForObject <IRegisterable>(cell);

            var reusableCell = _uiCollectionView.DequeueReusableSupplementaryView(UICollectionElementKindSection.Header, CollectionViewRenderer.SectionHeaderId, indexPath) as ContentCellContainer;

            var nativeCell = renderer.GetCell(cell, reusableCell, _uiCollectionView) as ContentCellContainer;

            var cellWithContent = nativeCell;

            // Sometimes iOS for returns a dequeued cell whose Layer is hidden.
            // This prevents it from showing up, so lets turn it back on!
            if (cellWithContent.Layer.Hidden)
            {
                cellWithContent.Layer.Hidden = false;
            }

            // Because the layer was hidden we need to layout the cell by hand
            if (cellWithContent != null)
            {
                cellWithContent.LayoutSubviews();
            }

            return(nativeCell);
        }
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            var headerView = (Header)collectionView.DequeueReusableSupplementaryView(elementKind, headerId, indexPath);

            headerView.Text = "Supplementary View";
            return(headerView);
        }
예제 #11
0
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            if (elementKind.Description.Contains(UICollectionElementKindSection.Header.ToString()))
            {
                var headerView = (NoteHeader)collectionView.DequeueReusableSupplementaryView(elementKind, new NSString("noteHeader"), indexPath);

                Chapter chapter = dictionary.Skip(indexPath.Section).FirstOrDefault().Key;
                if (chapter != null)
                {
                    headerView.CH        = chapter;
                    headerView.IndexPath = indexPath;
                    headerView.Text      = "Chapter " + chapter.ChapterNumber.ToString() + "  |  " + chapter.Title;
                    headerView.Expanded  = dictionary [chapter].Count == 0 ? false : true;

                    if (headerView.Expanded)
                    {
                        headerView.Update(FRDLivelyButtonStyle.CaretDown);
                    }
                    else
                    {
                        headerView.Update(FRDLivelyButtonStyle.CaretUp);
                    }

                    headerView.CollapseEvent -= HandleCollapseEvent;
                    headerView.CollapseEvent += HandleCollapseEvent;

                    headerView.ExpandEvent -= HandleExpandEvent;
                    headerView.ExpandEvent += HandleExpandEvent;
                }

                return(headerView);
            }

            return(null);
        }
예제 #12
0
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            var view = (THeaderCellView)collectionView.DequeueReusableSupplementaryView(UICollectionElementKindSection.Header, headerIdentifier, indexPath);

            this.source.PrepareHeader(indexPath.Section, view);
            return(view);
        }
		// TODO: Step 2c: uncomment to get a header instance to use for the Supplementary View
		public override UICollectionReusableView GetViewForSupplementaryElement (UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
		{
			// get a Header instance to use for the supplementary view
			var headerView = (Header)collectionView.DequeueReusableSupplementaryView (elementKind, headerId, indexPath);
			headerView.Text = "Evolve Speakers";
			return headerView;
		}
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            if (!CollectionView.IsGroupingEnabled)
            {
                return(null);
            }

            if (elementKind == "UICollectionElementKindSectionFooter")
            {
                return(null);
            }

            ContentCell          cell;
            ContentCellContainer nativeCell;

            var realIndexPath = GetRealIndexPath(indexPath);

            Performance.Start(out string reference);


            var cachingStrategy = CollectionView.CachingStrategy;

            if (cachingStrategy == ListViewCachingStrategy.RetainElement)
            {
                nativeCell = GetNativeHeaderCell(realIndexPath);
            }
            else if ((cachingStrategy & ListViewCachingStrategy.RecycleElement) != 0)
            {
                // Here is used the argument indexPath as it is because header cell will be got not to displayed when IsInfinite.
                nativeCell = collectionView.DequeueReusableSupplementaryView(
                    UICollectionElementKindSection.Header,
                    CollectionViewRenderer.SectionHeaderId,
                    indexPath
                    ) as ContentCellContainer;

                if (nativeCell.ContentCell == null)
                {
                    nativeCell = GetNativeHeaderCell(realIndexPath);
                }
                else
                {
                    var templatedList = TemplatedItemsView.TemplatedItems.GetGroup(realIndexPath.Section);

                    cell = (ContentCell)((INativeElementView)nativeCell).Element;
                    cell.SendDisappearing();

                    templatedList.UpdateHeader(cell, realIndexPath.Section);
                    cell.SendAppearing();
                }
            }
            else
            {
                throw new NotSupportedException();
            }

            Performance.Stop(reference);

            return(nativeCell);
        }
예제 #15
0
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            var headerView = collectionView.DequeueReusableSupplementaryView(elementKind, ResultViewController.feedHeadId, indexPath);

            headerView.AddSubview(feedCell);

            return(headerView);
        }
예제 #16
0
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            var header = (HeaderCollectionViewCell)collectionView.DequeueReusableSupplementaryView(UICollectionElementKindSection.Header, HeaderCollectionViewCell.Key, indexPath);

            header.UpdateCell();

            return(header);
        }
예제 #17
0
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            var header     = (WHeader)collectionView.DequeueReusableSupplementaryView(elementKind, WHeader.CELL_ID, indexPath);
            var nativeView = Header.ToUIView(new CGRect(0, 0, header.Frame.Width, header.Frame.Height));

            header.RendererView = nativeView;
            return(header);
        }
        protected override UICollectionReusableView GetGroupCell(UICollectionView collectionView, NSIndexPath indexPath, IDataCollectionGroup <object, object> group)
        {
            var header = collectionView.DequeueReusableSupplementaryView(UICollectionElementKindSection.Header, YouTubeHeaderIdentifier, indexPath) as YouTubeHeaderCell;

            header.Title.Text = group.Group.ToString().ToUpper();
            header.Title.Font = UIFont.SystemFontOfSize(UIFont.SmallSystemFontSize);
            return(header);
        }
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            // get a Header instance to use for the supplementary view
            var headerView = (Header)collectionView.DequeueReusableSupplementaryView(elementKind, headerId, indexPath);

            headerView.Text = "Evolve Speakers";
            return(headerView);
        }
예제 #20
0
 public UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
 {
     if (!elementKind.Equals(UICollectionElementKindSectionKey.Header))
     {
         return(null);
     }
     return(collectionView.DequeueReusableSupplementaryView(UICollectionElementKindSectionKey.Header, nameof(SearchHeader), indexPath) as SearchHeader);
 }
예제 #21
0
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView,
                                                                                NSString elementKind, NSIndexPath indexPath)
        {
            var headerView = collectionView.DequeueReusableSupplementaryView(elementKind,
                                                                             MyCollectionViewCell.headerId, indexPath) as MyCollectionViewCell;

            headerView.PooulateText("Weather now");
            return(headerView);
        }
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            var headerView = (BookHeader)collectionView.DequeueReusableSupplementaryView(elementKind, BookHeader.Key, indexPath);

            //TODO do whatever header initialization you need.
            headerView.HeaderText = SectionedItemsCollection[indexPath.Section].HeaderText;

            return(headerView);
        }
예제 #23
0
 public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
 {
     if (elementKind == (NSString)"UICollectionElementKindSectionHeader") {
         return (UICollectionReusableView)collectionView.DequeueReusableSupplementaryView
             (UICollectionElementKindSection.Header, (NSString)"collectionheader", indexPath);
     } else {
         StartReadingView footer = (StartReadingView)collectionView.DequeueReusableSupplementaryView
             (UICollectionElementKindSection.Footer, (NSString)"collectionfooter", indexPath);
         footer.StartReading.SetBackgroundImage (UIImage.FromFile ("./Assets/buttonlong.png"), UIControlState.Normal);
         if (!attached) {
             footer.StartReading.TouchUpInside += (object sender, EventArgs e) => {
                 var tabbar = new MainTabController ();
                 UIApplication.SharedApplication.Delegate.Window.RootViewController = tabbar;
             };
             attached = true;
         }
         return footer;
     }
 }
예제 #24
0
        void ConfigureDataSource()
        {
            dataSource = new UICollectionViewDiffableDataSource <NSNumber, NSNumber> (collectionView, CellProviderHandler)
            {
                SupplementaryViewProvider = SupplementaryViewProviderHandler
            };

            // initial data
            var snapshot        = new NSDiffableDataSourceSnapshot <NSNumber, NSNumber> ();
            var idOffset        = 0;
            var itemsPerSection = 18;

            foreach (var section in SectionKind.AllSections)
            {
                snapshot.AppendSections(new [] { NSNumber.FromInt32(section.EnumValue) });
                var items = Enumerable.Range(idOffset, itemsPerSection).Select(i => NSNumber.FromInt32(i)).ToArray();
                snapshot.AppendItems(items);
                idOffset += itemsPerSection;
            }

            dataSource.ApplySnapshot(snapshot, false);

            UICollectionViewCell CellProviderHandler(UICollectionView collectionView, NSIndexPath indexPath, NSObject obj)
            {
                // Get a cell of the desired kind.
                var cell = collectionView.DequeueReusableCell(TextCell.Key, indexPath) as TextCell;

                // Populate the cell with our item description.
                cell.Label.Text = $"{indexPath.Section}, {indexPath.Row}";
                cell.ContentView.BackgroundColor    = UIColorExtensions.CornflowerBlue;
                cell.ContentView.Layer.BorderColor  = UIColor.Black.CGColor;
                cell.ContentView.Layer.BorderWidth  = 1;
                cell.ContentView.Layer.CornerRadius = 8;
                cell.Label.TextAlignment            = UITextAlignment.Center;
                cell.Label.Font = UIFont.GetPreferredFontForTextStyle(UIFontTextStyle.Title1);

                // Return the cell.
                return(cell);
            }

            UICollectionReusableView SupplementaryViewProviderHandler(UICollectionView collectionView, string kind, NSIndexPath indexPath)
            {
                var sectionKind = SectionKind.GetSectionKind(indexPath.Section);

                // Get a supplementary view of the desired kind.
                var header = collectionView.DequeueReusableSupplementaryView(new NSString(kind),
                                                                             TitleSupplementaryView.Key, indexPath) as TitleSupplementaryView;

                // Populate the view with our section's description.
                header.Label.Text = $".{sectionKind}";

                // Return the view.
                return(header);
            }
        }
예제 #25
0
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            var headerView = (GotoCollectionReusableView)collectionView.DequeueReusableSupplementaryView(elementKind, "HeaderView", indexPath);

            headerView.BackgroundColor     = bgColor;
            inputNumberLabel.Frame         = new CoreGraphics.CGRect(0, 25, 318, 30);
            inputNumberLabel.TextAlignment = UITextAlignment.Center;
            inputNumberLabel.Font          = UIFont.SystemFontOfSize(40);
            headerView.AddSubview(inputNumberLabel);
            return(headerView);
        }
예제 #26
0
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            if (elementKind == CalendarCollectionViewLayout.HourSupplementaryViewKind)
            {
                var reusableView = collectionView.DequeueReusableSupplementaryView(elementKind, hourReuseIdentifier, indexPath) as HourSupplementaryView;
                var hour         = date.AddHours((int)indexPath.Item);
                reusableView.SetLabel(hour.ToString(supplementaryHourFormat(), CultureInfo.CurrentCulture));
                return(reusableView);
            }
            else if (elementKind == CalendarCollectionViewLayout.EditingHourSupplementaryViewKind)
            {
                var reusableView = collectionView.DequeueReusableSupplementaryView(elementKind, editingHourReuseIdentifier, indexPath) as EditingHourSupplementaryView;
                var attrs        = layoutAttributes[(int)editingItemIndexPath.Item];
                var hour         = (int)indexPath.Item == 0 ? attrs.StartTime.ToLocalTime() : attrs.EndTime.ToLocalTime();
                reusableView.SetLabel(hour.ToString(editingHourFormat(), CultureInfo.CurrentCulture));
                return(reusableView);
            }

            return(collectionView.DequeueReusableSupplementaryView(elementKind, currentTimeReuseIdentifier, indexPath));
        }
예제 #27
0
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            if (elementKind == UICollectionElementKindSectionKey.Header)
            {
                FeedSectionHeader headerView = (FeedSectionHeader)collectionView.DequeueReusableSupplementaryView(elementKind, FeedSectionHeader.Key, indexPath);
                headerView.UpdateContent(Rows[indexPath.Section].Title, Rows[indexPath.Section].Description);
                return(headerView);
            }

            return(base.GetViewForSupplementaryElement(collectionView, elementKind, indexPath));
        }
예제 #28
0
        void ConfigureDataSource()
        {
            dataSource = new UICollectionViewDiffableDataSource <NSNumber, NSNumber> (collectionView, CellProviderHandler)
            {
                SupplementaryViewProvider = SupplementaryViewProviderHandler
            };

            // initial data
            var itemsPerSection = 5;
            var sections        = Enumerable.Range(0, 5).Select(i => NSNumber.FromInt32(i)).ToArray();
            var snapshot        = new NSDiffableDataSourceSnapshot <NSNumber, NSNumber> ();
            var itemOffset      = 0;

            foreach (var section in sections)
            {
                snapshot.AppendSections(new [] { section });
                var items = Enumerable.Range(itemOffset, itemsPerSection).Select(i => NSNumber.FromInt32(i)).ToArray();
                snapshot.AppendItems(items);
                itemOffset += itemsPerSection;
            }

            dataSource.ApplySnapshot(snapshot, false);

            UICollectionViewCell CellProviderHandler(UICollectionView collectionView, NSIndexPath indexPath, NSObject obj)
            {
                // Get a cell of the desired kind.
                var cell = collectionView.DequeueReusableCell(ListCell.Key, indexPath) as ListCell;

                // Populate the cell with our item description.
                cell.Label.Text = $"{indexPath.Section}, {indexPath.Row}";

                // Return the cell.
                return(cell);
            }

            UICollectionReusableView SupplementaryViewProviderHandler(UICollectionView collectionView, string kind, NSIndexPath indexPath)
            {
                // Get a supplementary view of the desired kind.
                var supplementaryView = collectionView.DequeueReusableSupplementaryView(new NSString(kind),
                                                                                        TitleSupplementaryView.Key, indexPath) as TitleSupplementaryView;

                // Populate the view with our section's  description.
                var viewKind = kind == sectionHeaderElementKind ? "Header" : "Footer";

                supplementaryView.Label.Text        = $"{viewKind} for section {indexPath.Section}";
                supplementaryView.BackgroundColor   = UIColor.LightGray;
                supplementaryView.Layer.BorderColor = UIColor.Black.CGColor;
                supplementaryView.Layer.BorderWidth = 1;

                // Return the view.
                return(supplementaryView);
            }
        }
예제 #29
0
        public UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            headerId = headerId ?? new NSString(GridViewCell.HeaderKey);

            var headerCell = collectionView.DequeueReusableSupplementaryView(elementKind, headerId, indexPath) as GridViewCell;

            var item = Element.ItemsSource.Cast <object>().ElementAt(indexPath.Section);

            headerCell.RecycleCell(item, Element.GroupHeaderTemplate, Element);

            return(headerCell);
        }
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            if (elementKind == UICollectionElementKindSectionKey.Header && !HeaderReuseID.IsNullOrEmtpy() && indexPath.Section == 1)
            {
                var headerView = collectionView.DequeueReusableSupplementaryView(elementKind, HeaderReuseID, indexPath);

                if (_headerDataContext != null)
                {
                    SetupReusableView(headerView, elementKind, indexPath, _headerDataContext);
                }

                return(headerView);
            }

            if (elementKind == UICollectionElementKindSectionKey.Header && !BannersHeaderReuseID.IsNullOrEmtpy() && indexPath.Section == 0)
            {
                var headerView = collectionView.DequeueReusableSupplementaryView(elementKind, BannersHeaderReuseID, indexPath);

                if (ViewModel != null)
                {
                    SetupReusableView(headerView, elementKind, indexPath, ViewModel);
                }

                return(headerView);
            }

            if (elementKind == UICollectionElementKindSectionKey.Footer && !FooterReuseID.IsNullOrEmtpy() && indexPath.Section == 1)
            {
                var footerView = collectionView.DequeueReusableSupplementaryView(elementKind, FooterReuseID, indexPath);

                if (ViewModel != null)
                {
                    SetupReusableView(footerView, elementKind, indexPath, ViewModel);
                }

                return(footerView);
            }

            return(null);
        }
        protected virtual UICollectionReusableView GetHeaderView(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var header = collectionView.DequeueReusableSupplementaryView(
                UICollectionElementKindSectionKey.Header,
                GetHeaderViewName(indexPath),
                indexPath);

            var bindableHeader = (IBindableView)header;

            bindableHeader.ReloadDataContext(DataSource.ElementAt(indexPath.Section).Key);

            return(header);
        }
예제 #32
0
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            var view = collectionView.DequeueReusableSupplementaryView(elementKind, ChipCollectionHeaderView.Key, indexPath) as ChipCollectionHeaderView;

            view.TitleLabel.Text      = Sections[indexPath.Section].Title;
            view.TitleLabel.TextColor = Color.PRIMARY_TEXT_COLOR.ToUIColor();
            if (UIScreen.MainScreen.Bounds.Height < 600)
            {
                view.TitleTopMarginConstraint.Constant = 10;
            }

            return(view);
        }
            // for disable footer, see Delegate.GetReferenceSizeForFooter implementation
            protected override UICollectionReusableView GetFooterView(UICollectionView collectionView, NSIndexPath indexPath)
            {
                var footer = collectionView.DequeueReusableSupplementaryView(
                    UICollectionElementKindSectionKey.Footer,
                    typeof(GroupedFooterView).Name,
                    indexPath);

                var bindableFooter = (IBindableView)footer;

                bindableFooter.ReloadDataContext(DataSource.ElementAt(indexPath.Section).Key);

                return(footer);
            }
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            if (elementKind == UICollectionElementKindSectionKey.Header)
            {
                var header = collectionView.DequeueReusableSupplementaryView(UICollectionElementKindSection.Header, QuickCurrencyHeaderCell.Key, indexPath) as QuickCurrencyHeaderCell;
                header.Setup(CurrentBaseCurrency, CurrentBaseCurrencyAmount);

                UITapGestureRecognizer guesture = new UITapGestureRecognizer(() =>
                {
                    HeaderTapped();
                })
                {
                    NumberOfTapsRequired = 1
                };

                header.AddGestureRecognizer(guesture);

                return header;
            }

            return null;
        }
예제 #35
0
 public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
 {
     _headerView = (HeaderView)collectionView.DequeueReusableSupplementaryView (elementKind, headerId, indexPath);
     _headerView.TileGrid = _tileGrid;
     return _headerView;
 }
 public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
 {
     var headerView = (Header) collectionView.DequeueReusableSupplementaryView (elementKind, headerId, indexPath);
     headerView.Center = collectionView.Center;
     return headerView;
 }