Beispiel #1
0
        /// <summary>
        /// Inserts the given item at the specified index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="item">The item.</param>
        public void Insert(int index, T item)
        {
            this.EnsureNotDisposed();
            InsertEventArgs <T> args = new InsertEventArgs <T>(index, item);

            this.OnInsert(args);
            if (!args.Cancel)
            {
                //Inseriamo il nuovo elemento
                this.Storage.Insert(index, item);
                this.WireListItem(item);

                this.OnInsertCompleted(index, item);
                this.OnCollectionChanged(new CollectionChangedEventArgs <T>(CollectionChangeType.ItemAdded, index, -1, item));
            }
        }
Beispiel #2
0
        ///// <summary>
        ///// Returns the index of the supplied item, starting search at the specified index.
        ///// </summary>
        ///// <param name="value">The item.</param>
        ///// <param name="startIndex">The start index.</param>
        ///// <returns></returns>
        //public int IndexOf( T value, int startIndex )
        //{
        //    this.EnsureNotDisposed();
        //    return this.Storage.IndexOf( value, startIndex );
        //}

        /// <summary>
        /// Called just before the Insert
        /// </summary>
        /// <param name="e">The <see cref="Radical.Model.InsertEventArgs&lt;T&gt;"/> instance containing additional data.</param>
        protected virtual void OnInsert(InsertEventArgs <T> e)
        {
            this.EnsureNotDisposed();
        }