Open.Core.Lists.ListView.Insert C# (CSharp) Метод

Insert() публичный Метод

Inserts a list-item for the given model at the specified index.
public Insert ( int index, object model ) : void
index int The index to insert at (0-based).
model object The data-model for the item.
Результат void
        public void Insert(int index, object model)
        {
            // Setup initial conditions.
            jQueryObject insertBefore = InsertBefore(index);

            // Construct the list-item control.
            IView view = CreateItem(model);
            IListItemView listItemView = view as IListItemView;

            // Insert the containing DIV.
            jQueryObject div = view.Container;
            if (insertBefore == null)
            {
                div.AppendTo(Container);
            }
            else
            {
                div.InsertBefore(insertBefore);
            }

            // Store values.
            itemViews.Add(view);

            // Wire up events.
            if (listItemView != null) div.Click(delegate(jQueryEvent e) { OnItemClick(e, listItemView); });

            INotifyPropertyChanged observableView = view as INotifyPropertyChanged;
            if (observableView != null) observableView.PropertyChanged += OnViewPropertyChanged;
        }
        #endregion