void ApplyTemplateAndDataContext(TemplatedCell cell, NSIndexPath indexPath) { // We need to create a renderer, which means we need a template var view = _itemsView.ItemTemplate.CreateContent() as View; _itemsView.AddLogicalChild(view); var renderer = CreateRenderer(view); BindableObject.SetInheritedBindingContext(view, _itemsSource[indexPath.Row]); cell.SetRenderer(renderer); }
void ApplyTemplateAndDataContext(TemplatedCell cell, NSIndexPath indexPath) { // We need to create a renderer, which means we need a template var templateElement = _itemsView.ItemTemplate.CreateContent() as View; IVisualElementRenderer renderer = CreateRenderer(templateElement); if (renderer != null) { BindableObject.SetInheritedBindingContext(renderer.Element, _itemsSource[indexPath.Row]); cell.SetRenderer(renderer); } }
void ApplyTemplateAndDataContext(TemplatedCell cell, NSString elementKind, NSIndexPath indexPath) { DataTemplate template; if (elementKind == UICollectionElementKindSectionKey.Header) { template = GroupableItemsView.GroupHeaderTemplate; } else { template = GroupableItemsView.GroupFooterTemplate; } var templateElement = template.CreateContent() as View; var renderer = CreateRenderer(templateElement); BindableObject.SetInheritedBindingContext(renderer.Element, ItemsSource.Group(indexPath)); cell.SetRenderer(renderer); }
void ApplyTemplateAndDataContext(TemplatedCell cell, NSIndexPath indexPath) { var template = _itemsView.ItemTemplate; var item = _itemsSource[indexPath.Row]; // Run this through the extension method in case it's really a DataTemplateSelector template = template.SelectDataTemplate(item, _itemsView); // Create the content and renderer for the view and var view = template.CreateContent() as View; var renderer = CreateRenderer(view); cell.SetRenderer(renderer); // Bind the view to the data item view.BindingContext = _itemsSource[indexPath.Row]; // And make sure it's a "child" of the ItemsView _itemsView.AddLogicalChild(view); }