コード例 #1
0
        internal void OnLayoutDefinitionChanged(LayoutDefinitionBase oldLayoutDefinition, LayoutDefinitionBase newLayoutDefinition)
        {
            this.owner.ScrollToTop();

            if (oldLayoutDefinition != null)
            {
                oldLayoutDefinition.PropertyChanged -= LayoutDefinition_PropertyChanged;
            }

            if (newLayoutDefinition != null)
            {
                newLayoutDefinition.PropertyChanged += LayoutDefinition_PropertyChanged;
            }

            if (this.strategy != null)
            {
                this.strategy.FullyRecycle();
            }

            this.strategy = newLayoutDefinition.CreateStrategy(this.modelGenerator, this.owner);

            if (this.model.CurrentDataProvider != null && this.model.CurrentDataProvider.Status == DataProviderStatus.Ready)
            {
                this.model.SetLayoutSource();
            }

            this.strategy.FullyRecycle();

            this.owner.UpdateService.RegisterUpdate((int)UpdateFlags.AffectsContent);

            // TODO: add callback for orientation changed
        }
コード例 #2
0
        public LayoutController(IListView owner, ListViewModel model)
        {
            this.owner = owner;

            this.modelGenerator = new ItemModelGenerator(this.owner.ContainerGenerator);

            this.strategy = new StackLayoutStrategy(this.modelGenerator, owner);

            this.model = model;
        }