Esempio n. 1
0
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            if (elementKind == UICollectionElementKindSectionKey.Header)
            {
                var album  = MomentAlbumList[indexPath.Section];
                var header = CollectionView.DequeueReusableSupplementaryView(elementKind, "MomentHeader", indexPath) as MomentSectionHeaderView;
                if (header != null)
                {
                    header.locationLabel.Text = album.Title;
                    if (album.Date != null)
                    {
                        var formatter = new NSDateFormatter();
                        formatter.DateStyle   = NSDateFormatterStyle.Long;
                        formatter.TimeStyle   = NSDateFormatterStyle.None;
                        header.dateLabel.Text = formatter.StringFor(album.Date);
                    }
                    else
                    {
                        header.dateLabel.Text = string.Empty;
                    }
                    return(header);
                }
                else
                {
                    throw new Exception("failed to create MomentHeader");
                }
            }
            return(null);

            //return base.GetViewForSupplementaryElement(collectionView, elementKind, indexPath);
        }
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            var header = CollectionView.DequeueReusableSupplementaryView(elementKind, AppDetailHeaderCell.Id, indexPath) as AppDetailHeaderCell;

            header.DataContext = _appDetailView.ViewModel.StoreApp;

            return(header);
        }
Esempio n. 3
0
        public UICollectionReusableView GetViewForSupplementaryElement(NSString elementKind, NSIndexPath indexPath)
        {
            if (_headerView == null)
            {
                _headerView =
                    (HeaderForCollectionView)
                    CollectionView.DequeueReusableSupplementaryView(elementKind, HeaderId, indexPath);

                _bindings.Add(
                    this.SetBinding(
                        () => _source.SelectedItem.Name,
                        () => _headerView.SelectedItemLabel.Text,
                        fallbackValue: "Nothing yet"));
            }

            return(_headerView);
        }