Ejemplo n.º 1
0
            internal void ConfigureCellAt(DropdownCell cell, int index)
            {
                Console.WriteLine("ConfigureCellAt " + index);
                bool _ = dropdownReference.TryGetTarget(out Dropdown dropdown);

                if (index >= 0 && index < dropdown.dataSource.Count())
                {
                    cell.AccessibilityIdentifier = dropdown.dataSource[index].ToString();
                }

                cell.TitleLabel.TextColor = dropdown.textColor;
                cell.TitleLabel.Font      = dropdown.textFont;
                cell.SelectedColor        = dropdown.SelectionBackgroundColor;

                cell.TitleLabel.Text = dropdown.dataSource[index].ToString();

                if (dropdown.customCellConfiguration != null)
                {
                    dropdown.customCellConfiguration(index, dropdown.dataSource[index], cell);
                }
            }
Ejemplo n.º 2
0
        private nfloat FittingWidth()
        {
            if (templateCell == null)
            {
                templateCell = cellNib.Instantiate(null, null)[0] as DropdownCell;
            }

            nfloat maxWidth = 0;

            for (int index = 0; index < dataSource.Count(); index++)
            {
                var ds = tableView.Source as DropdownDatasource;
                ds.ConfigureCellAt(templateCell, index);
                templateCell.Bounds = new CGRect(templateCell.Bounds.Location, new CGSize(templateCell.Bounds.Width, CellHeight));

                var w = templateCell.SystemLayoutSizeFittingSize(UILayoutFittingCompressedSize).Width;
                if (w > maxWidth)
                {
                    maxWidth = w;
                }
            }

            return(maxWidth);
        }