public override nfloat GetHeightForRow(UITableView tableView, Foundation.NSIndexPath indexPath)
        {
            if (!CachedHeight.TryGetValue(indexPath, out float itemHeight))
            {
                var itemVm = GetItemAt(indexPath);

                if (itemVm is IProductDetailsItemVM detailsItemVm)
                {
                    itemHeight = WidgetHeight.Invoke(detailsItemVm, detailsItemVm.WidgetType, detailsItemVm.DataType);
                }
                else
                {
                    itemHeight = WidgetHeight.Invoke(itemVm, null, null);
                }

                CachedHeight[indexPath] = itemHeight;
            }

            return(itemHeight);
        }
Ejemplo n.º 2
0
        public override void ReloadTableData()
        {
            if (ItemsSource != null && ItemsSource.Count() > 0)
            {
                CachedHeight.Clear();

                for (int i = 0; i < ItemsSource.Count(); i++)
                {
                    var indexPath = NSIndexPath.FromRowSection(i, 0);
                    GetHeightForRow(TableView, indexPath);
                }

                base.ReloadTableData();

                for (int i = 0; i < ItemsSource.Count(); i++)
                {
                    var indexPath = NSIndexPath.FromRowSection(i, 0);
                    GetCell(TableView, indexPath);
                }
            }
        }
Ejemplo n.º 3
0
        public override nfloat GetHeightForRow(UITableView tableView, Foundation.NSIndexPath indexPath)
        {
            float itemHeight = 0;

            if (!CachedHeight.TryGetValue(indexPath, out itemHeight))
            {
                var itemVm = GetItemAt(indexPath) as IFiltersItemVM;

                if (itemVm != null)
                {
                    switch (itemVm.WidgetType)
                    {
                    case FilterWidgetType.HorizontalCollection:
                    {
                        itemHeight = HorizontalCollectionCell.HORIZONTAL_COLLECTION_HEIGHT;

                        break;
                    }

                    case FilterWidgetType.VerticalCollection:
                    {
                        float itemsHeight = 0;

                        var verticalItemVm = itemVm as IVerticalCollectionFiVm;
                        if (verticalItemVm != null)
                        {
                            itemsHeight = verticalItemVm.Values.IsNullOrEmpty() ?
                                          0 :
                                          ((verticalItemVm.Values.Count / 4) + (verticalItemVm.Values.Count % 4 == 0 ? 0 : 1)) * VerticalCollectionCell.VERTICAL_COLLECTION_ITEM_HEIGHT;
                            itemsHeight += VerticalCollectionCell.VERTICAL_COLLECTION_BOTTOM_INSET;
                        }

                        itemHeight = VerticalCollectionCell.VERTICAL_COLLECTION_TITLE_HEIGHT + itemsHeight;

                        break;
                    }

                    case FilterWidgetType.MinMax:
                    {
                        itemHeight = BaseMinMaxCell.MIN_MAX_HEIGHT;

                        break;
                    }

                    case FilterWidgetType.Picker:
                    {
                        itemHeight = PickerCell.PICKER_TITLE_HEIGHT;

                        var pickerItemVm = itemVm as IPickerFiVm;
                        if (pickerItemVm != null && pickerItemVm.Selected)
                        {
                            itemHeight += PickerCell.PICKER_CONTENT_HEIGHT;
                        }

                        break;
                    }

                    case FilterWidgetType.OneSelection:
                    {
                        itemHeight = OneSelectionCell.ONE_SELECTION_HEIGHT;

                        var oneItemVm = itemVm as IOneSelectionFiVm;
                        if (!oneItemVm.ValueName.IsNullOrEmtpy())
                        {
                            itemHeight += OneSelectionCell.ONE_SELECTION_CONTENT_HEIGHT;
                        }

                        break;
                    }

                    case FilterWidgetType.MultiSelection:
                    {
                        itemHeight = MultiSelectionCell.MULTY_SELECTION_TITLE_HEIGHT;

                        var multiItemVm = itemVm as IMultiSelectionFiVm;
                        if (multiItemVm != null && !multiItemVm.Items.IsNullOrEmpty())
                        {
                            itemHeight += MultiSelectionCell.MULTY_SELECTION_CONTENT_HEIGHT;
                        }

                        break;
                    }

                    case FilterWidgetType.Switch:
                    {
                        itemHeight = SwitchCell.SWITCH_HEIGHT;

                        break;
                    }
                    }
                }
            }

            CachedHeight[indexPath] = itemHeight;

            return(itemHeight);
        }
Ejemplo n.º 4
0
 public void ClearCachedHeights()
 {
     CachedHeight.Clear();
 }
 public void ClearCache()
 {
     CachedHeight.Clear();
     CachedCells.Clear();
 }