Ejemplo n.º 1
0
        private void SetupTable()
        {
            _source = new GenericTableviewSourceWithHeight <IGroup>(ItemsTable)
            {
                GetIdentifierFunc = (group, path) => GroupCell.Identifier,
                ModifyCellFunc    = (cell, path, group) =>
                {
                    var groupCell = cell as GroupCell;

                    if (groupCell != null)
                    {
                        // Only 1 section
                        groupCell.SetIsFirstCell(true);
                        groupCell.GroupDescription.AttributedText = GetText(group.Id, group.Description);
                    }
                },
                GetCellHeightFunc = (view, path, group) => 220,
                //{
                //    if (path.Row == 0)
                //    {
                //        return 220;
                //    }

                //    return 180;
                //},
                GetEstimatedHeightFunc = (view, path, group) => 220,
                //{
                //    if (path.Row == 0)
                //    {
                //        return 220;
                //    }

                //    return 180;
                //},
                UseAnimations = false,
            };

            _refreshControl = new MvxUIRefreshControl();

            ItemsTable.DelaysContentTouches = false;

            foreach (var subview in ItemsTable.Subviews)
            {
                if (subview is UIScrollView)
                {
                    ((UIScrollView)subview).DelaysContentTouches = false;
                }
            }

            ItemsTable.BackgroundColor = Appearance.Colors.BackgroundColor;
            ItemsTable.AddSubviews(_refreshControl);
            ItemsTable.SeparatorStyle = UITableViewCellSeparatorStyle.None;
            ItemsTable.RegisterClassForCellReuse(typeof(GroupCell), GroupCell.Identifier);
            ItemsTable.AllowsSelection = false;
            ItemsTable.Source          = _source;
        }
Ejemplo n.º 2
0
        private void SetupTable()
        {
            _membersSource = new GenericTableviewSourceWithHeight <IItemBase>(ItemsTable)
            {
                GetIdentifierFunc = (item, path) =>
                {
                    if (item is MemberSearchItem)
                    {
                        return(MembersSearchCell.Identifier);
                    }

                    if (item is MembersButtonItem)
                    {
                        return(MembersButtonCell.Identifier);
                    }

                    if (item is ICompany)
                    {
                        return(MembersCompanyCell.Identifier);
                    }

                    return(MemberCell.Identifier);
                },
                RowSelectionFunc = (view, path, baseItem) =>
                {
                    ViewModel.MemberSelected(baseItem);
                },
                GetCellHeightFunc = (view, path, item) =>
                {
                    if (item is MembersButtonItem)
                    {
                        Debug.WriteLine("BUTTON ITEM AT ROW : {0}", path.Row);
                    }

                    if (item is IUser || item is ICompany)
                    {
                        return(68);
                    }

                    return(62);
                },
                GetEstimatedHeightFunc = (view, path, item) =>
                {
                    if (item is IUser || item is ICompany)
                    {
                        return(68);
                    }

                    return(62);
                },
                //ViewToMove = SearchContainer,
                //ConstraintToChange = SearchContainerTopConstraint,
                UseAnimations    = true,
                AddAnimation     = UITableViewRowAnimation.Left,
                RemoveAnimation  = UITableViewRowAnimation.Right,
                ReplaceAnimation = UITableViewRowAnimation.Middle,
                AutoDeselect     = true,
            };

            ItemsTable.BackgroundColor = Appearance.Colors.BackgroundColor;
            ItemsTable.RegisterClassForCellReuse(typeof(MembersCompanyCell), MembersCompanyCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(MembersButtonCell), MembersButtonCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(MembersSearchCell), MembersSearchCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(MemberCell), MemberCell.Identifier);
            ItemsTable.Source = _membersSource;

            _refreshControl = new MvxUIRefreshControl();
            ItemsTable.AddSubviews(_refreshControl);
        }