예제 #1
0
        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.Parent         = _context.Shell;
                view.BindingContext = context;
                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;

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

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

            _views[context] = cell.View;
            return(cell);
        }