GroupTemplateContext CreateGroupTemplateContext(object group)
        {
            var groupHeaderTemplateContext = _groupHeaderTemplate != null
                                        ? new ItemTemplateContext(_groupHeaderTemplate, group, _container) : null;

            var groupFooterTemplateContext = _groupFooterTemplate != null
                                ? new GroupFooterItemTemplateContext(_groupFooterTemplate, group, _container) : null;

            // This is where we'll eventually look at GroupItemPropertyName
            var groupItemsList = TemplatedItemSourceFactory.Create(group as IEnumerable, _itemTemplate, _container);

            return(new GroupTemplateContext(groupHeaderTemplateContext, groupFooterTemplateContext, groupItemsList));
        }
Пример #2
0
        protected override CollectionViewSource CreateCollectionViewSource()
        {
            var collectionViewSource = TemplatedItemSourceFactory.Create(Element.ItemsSource, Element.ItemTemplate, Element,
                                                                         GetItemHeight(), GetItemWidth(), GetItemSpacing());

            if (collectionViewSource is ObservableItemTemplateCollection observableItemsSource)
            {
                observableItemsSource.CollectionChanged += CollectionItemsSourceChanged;
            }

            return(new CollectionViewSource
            {
                Source = collectionViewSource,
                IsSourceGrouped = false
            });
        }
Пример #3
0
        protected override CollectionViewSource CreateCollectionViewSource()
        {
            if (ItemsView != null && ItemsView.IsGrouped)
            {
                var itemTemplate = Element.ItemTemplate;
                var itemsSource  = Element.ItemsSource;

                return(new CollectionViewSource
                {
                    Source = TemplatedItemSourceFactory.CreateGrouped(itemsSource, itemTemplate,
                                                                      ItemsView.GroupHeaderTemplate, ItemsView.GroupFooterTemplate, Element),
                    IsSourceGrouped = true,
                    ItemsPath = new global::Windows.UI.Xaml.PropertyPath(nameof(GroupTemplateContext.Items))
                });
            }
            else
            {
                return(base.CreateCollectionViewSource());
            }
        }
Пример #4
0
        protected virtual CollectionViewSource CreateCollectionViewSource()
        {
            var itemsSource  = Element.ItemsSource;
            var itemTemplate = Element.ItemTemplate;

            if (itemTemplate != null)
            {
                return(new CollectionViewSource
                {
                    Source = TemplatedItemSourceFactory.Create(itemsSource, itemTemplate, Element),
                    IsSourceGrouped = false
                });
            }

            return(new CollectionViewSource
            {
                Source = itemsSource,
                IsSourceGrouped = false
            });
        }