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));
        }
Exemplo n.º 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
            });
        }
Exemplo n.º 3
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
            });
        }