public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var proxy   = SearchController.ListProxy;
            int row     = indexPath.Row;
            var context = proxy[row];

            var template = SearchHandler.ItemTemplate;

            if (template == null)
            {
                template = DefaultTemplate;
            }

            var cellId = ((IDataTemplateController)template.SelectDataTemplate(context, _context.Shell)).IdString;

            var cell = (UIContainerCell)tableView.DequeueReusableCell(cellId);

            if (cell == null)
            {
                var view = (View)template.CreateContent(context, _context.Shell);
                view.BindingContext = context;
                view.Parent         = _context.Shell;
                cell = new UIContainerCell(cellId, view);
            }
            else
            {
                cell.View.BindingContext = context;
            }

            return(cell);
        }
예제 #2
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            int section = indexPath.Section;
            int row     = indexPath.Row;
            var context = Groups[section][row];

            DataTemplate template = ShellController.GetFlyoutItemDataTemplate(context);

            if (context is IMenuItemController)
            {
                if (DefaultMenuItemTemplate != null && _context.Shell.MenuItemTemplate == template)
                {
                    template = DefaultMenuItemTemplate;
                }
            }
            else
            {
                if (DefaultItemTemplate != null && _context.Shell.ItemTemplate == template)
                {
                    template = DefaultItemTemplate;
                }
            }

            var cellId = ((IDataTemplateController)template.SelectDataTemplate(context, _context.Shell)).IdString;

            UIContainerCell cell;

            if (!_cells.TryGetValue(context, out cell))
            {
                var view = (View)template.CreateContent(context, _context.Shell);
                cell = new UIContainerCell(cellId, view, _context.Shell, context);
            }
            else
            {
                var view = _cells[context].View;
                cell.Disconnect(keepRenderer: true);
                cell = new UIContainerCell(cellId, view, _context.Shell, context);
            }

            cell.SetAccessibilityProperties(context);

            _cells[context]              = cell;
            cell.TableView               = tableView;
            cell.IndexPath               = indexPath;
            cell.ViewMeasureInvalidated += OnViewMeasureInvalidated;

            return(cell);
        }
예제 #3
0
 void OnViewMeasureInvalidated(UIContainerCell cell)
 {
     cell.ReloadRow();
 }