public GeneratedItem Mount(T item, object source, ItemGenerator <T> generator, int generatorVersion, int collectionVersion)
            {
                Item              = item;
                Source            = source;
                Generator         = generator;
                GeneratorVersion  = generatorVersion;
                CollectionVersion = collectionVersion;

                return(this);
            }
            public void Release()
            {
                Item              = default;
                Source            = default;
                Generator         = default;
                GeneratorVersion  = default;
                CollectionVersion = default;

                Pool.Push(this);
            }
Example #3
0
        public override void AttachItem(TSelectionItem item, object source)
        {
            var selection = (Selection <TItem>)source;

            if (SelectionItemsControl.IsAttachDetachOverridenInternal)
            {
                SelectionItemsControl.AttachOverrideInternal(item, selection);

                return;
            }

            item.ItemsControl = SelectionItemsControl;
            item.Selection    = selection;

            if (ItemContentMemberBinding != null)
            {
                ItemGenerator <TSelectionItem> .InstallBinding(item, IconContentPresenter.ContentProperty, ItemContentMemberBinding);
            }
            else
            {
                switch (SelectionItemsControl.ContentMode)
                {
                case SelectionItemContentMode.None:
                    break;

                case SelectionItemContentMode.Selection:
                    item.Content = selection;
                    break;

                case SelectionItemContentMode.Item:
                    item.Content = selection.Item;
                    break;

                case SelectionItemContentMode.Source:
                    item.Content = selection.Source;
                    break;

                case SelectionItemContentMode.Value:
                    item.Content = selection.Value;
                    break;

                case SelectionItemContentMode.Index:
                    item.Content = selection.Index;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            item.ContentTemplate         = ItemContentTemplate;
            item.ContentTemplateSelector = ItemContentTemplateSelector;
            item.ContentStringFormat     = ItemContentStringFormat;
        }
Example #4
0
 public TemplatedGeneratorImplementation(ItemGenerator <TItem> generator)
 {
     Generator = generator;
 }