示例#1
0
        private void SetupTable()
        {
            _source = new GenericTableviewSourceWithHeight <IItemBase>(ItemsTable)
            {
                GetIdentifierFunc = (item, path) =>
                {
                    if (item is IEvent)
                    {
                        return(EventCell.Identifier);
                    }

                    return(HeaderImageCell.Identifier);
                },
                RowSelectionFunc = (view, path, item) =>
                {
                    if (item is IEvent)
                    {
                        ViewModel.EventSelected(item.Id);
                    }
                },
                AutoDeselect      = true,
                GetCellHeightFunc = (view, path, arg3) =>
                {
                    return(UIScreen.MainScreen.Bounds.Width * 0.5f + 2);
                },
                GetEstimatedHeightFunc = (view, path, item) =>
                {
                    return(UIScreen.MainScreen.Bounds.Width * 0.5f + 2);
                },
            };

            _refreshControl = new MvxUIRefreshControl();

            ItemsTable.AddSubview(_refreshControl);
            ItemsTable.AllowsSelection = true;
            ItemsTable.RegisterClassForCellReuse(typeof(EventCell), EventCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(HeaderImageCell), HeaderImageCell.Identifier);
            ItemsTable.Source = _source;
        }
示例#2
0
        private void SetupTable()
        {
            _source = new GenericTableViewSource <INotification>(ItemsTable)
            {
                GetIdentifierFunc = (item, path) => NotificationCell.Identifier,
                RowSelectionFunc  = (view, path, arg3) => ViewModel.SelectedCommand.Execute(arg3),
                AutoDeselect      = true,
                UseAnimations     = true,
                AddAnimation      = UITableViewRowAnimation.Top,
                RemoveAnimation   = UITableViewRowAnimation.Bottom,
                ReplaceAnimation  = UITableViewRowAnimation.Middle,
            };

            _refreshControl = new MvxUIRefreshControl();

            ItemsTable.RegisterClassForCellReuse(typeof(NotificationCell), NotificationCell.Identifier);
            ItemsTable.AddSubview(_refreshControl);
            ItemsTable.BackgroundColor    = Appearance.Colors.BackgroundColor;
            ItemsTable.RowHeight          = UITableView.AutomaticDimension;
            ItemsTable.EstimatedRowHeight = 44;
            ItemsTable.Source             = _source;
        }
        private void SetupTable()
        {
            _source = new GenericTableviewSourceWithHeight <IItemBase>(ItemsTable)
            {
                GetIdentifierFunc = (item, path) =>
                {
                    if (item is HeaderImage)
                    {
                        return(HeaderImageCell.Identifier);
                    }

                    if (item is Event)
                    {
                        return(EventCell.Identifier);
                    }

                    if (item is EventCategoryDouble)
                    {
                        return(EventCategoryDoubleCell.Identifier);
                    }

                    if (item is IEventCategory)
                    {
                        return(EventCategoryCell.Identifier);
                    }

                    return(AllEventsCell.Identifier);
                },
                GetCellHeightFunc = (view, path, item) =>
                {
                    return(GetCellHeight(item));
                },
                GetEstimatedHeightFunc = (view, path, item) =>
                {
                    return(GetCellHeight(item));
                }
                // TODO: Vanwege de double image header cell kan row selectie niet want we weten niet op welke plaats er is getapped in de cell, later verbeteren met tap gestures  : http://stackoverflow.com/questions/11070874/how-can-i-distinguish-which-part-of-uitableviewcell-has-been-clicked
                //RowSelectionFunc = (view, path, item) =>
                //{
                //    if (item is DoubleHeaderImage)
                //    {
                //        ViewModel.CategorySelected();

                //    }

                //    ViewModel.CategorySelected(item.Id);
                //    ItemsTable.DeselectRow(path, true);
                //}
            };

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

            _refreshControl = new MvxUIRefreshControl();
            ItemsTable.AddSubview(_refreshControl);

            ItemsTable.ContentInset    = new UIEdgeInsets(0, 0, 5, 0);
            ItemsTable.BackgroundColor = Appearance.Colors.BackgroundColor;
            // The image header is only shown when there is only 1 category in the platform
            ItemsTable.RegisterClassForCellReuse(typeof(HeaderImageCell), HeaderImageCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(EventCell), EventCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(EventCategoryCell), EventCategoryCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(AllEventsCell), AllEventsCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(EventCategoryDoubleCell), EventCategoryDoubleCell.Identifier);
            ItemsTable.Source = _source;
        }