Ejemplo 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
            };
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public override void Deinit()
        {
            base.Deinit();

            this.RemoveBinding(this.Collection);

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

            this.RemoveBinding(this.Collection);

            this.valueConverter = null;

            this.collectionBinding = null;
        }
Ejemplo 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);
        }