Esempio n. 1
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            int section = indexPath.Section;
            int row     = indexPath.Row;
            var context = Groups[section][row];

            DataTemplate template = null;

            if (context is MenuItem)
            {
                template = _context.Shell.MenuItemTemplate ?? DefaultMenuItemTemplate;
            }
            else
            {
                template = _context.Shell.ItemTemplate ?? 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;
            }

            return(cell);
        }
        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);
        }
Esempio n. 3
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);

                // Set Parent after binding context so parent binding context doesn't propagate to view
                cell.BindingContext = context;
                view.Parent         = _context.Shell;
            }
            else
            {
                var view = _cells[context].View;
                cell.Disconnect();
                cell = new UIContainerCell(cellId, view);
                cell.BindingContext = context;
            }

            cell.SetAccessibilityProperties(context);

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

            return(cell);
        }
Esempio n. 4
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);
                cell = new UIContainerCell(cellId, view);

                // Set Parent after binding context so parent binding context doesn't propagate to view
                cell.BindingContext = context;
                view.Parent         = _context.Shell;
            }
            else
            {
                cell.BindingContext = context;
            }

            cell.SetAccessibilityProperties(context);

            _views[context] = cell.View;
            return(cell);
        }
Esempio n. 5
0
 void OnViewMeasureInvalidated(UIContainerCell cell)
 {
     cell.ReloadRow();
 }