Esempio n. 1
0
        /// <inheritdoc />
        public override void Init()
        {
            base.Init();

            this.AddBinding(this.Collection);

            if (!string.IsNullOrEmpty(this.ConverterType))
            {
                // Create data converter.
                this.valueConverter =
                    (ValueConverter)Activator.CreateInstance(ReflectionUtils.FindType(this.ConverterType));
            }
            else
            {
                Debug.LogWarning("No converter set", this);
            }

            // Observe collection.
            this.collectionBinding = new CollectionDataBinding <object>(this.Collection)
            {
                CollectionChanged = this.OnCollectionChanged,
                ItemAdded         = this.OnItemAdded,
                ItemInserted      = this.OnItemInserted,
                ItemRemoved       = this.OnItemRemoved
            };
        }
Esempio n. 2
0
        /// <inheritdoc />
        public override void Deinit()
        {
            base.Deinit();

            this.RemoveBinding(this.Collection);

            this.collectionDataBinding = null;
        }
Esempio n. 3
0
        /// <inheritdoc />
        public override void Deinit()
        {
            base.Deinit();

            this.RemoveBinding(this.Collection);

            this.valueConverter = null;

            this.collectionBinding = null;
        }
Esempio n. 4
0
        /// <inheritdoc />
        public override void Init()
        {
            base.Init();

            this.collectionDataBinding = new CollectionDataBinding(this.Collection)
            {
                ItemAdded         = this.OnItemAdded,
                ItemInserted      = this.OnItemInserted,
                ItemRemoved       = this.OnItemRemoved,
                ClearedItems      = this.OnClearedItems,
                CollectionChanged = this.OnCollectionChanged
            };

            this.AddBinding(this.Collection);
        }