Exemple #1
0
 private void InsertChildAfter(MenuItemModel childToInsert, MenuItemModel relativePositionMarker)
 {
     var index = this._children.IndexOf(relativePositionMarker);
     this._children.Insert(index + 1, childToInsert);
     childToInsert.SetParent(this);
 }
Exemple #2
0
 /// <summary>
 /// Adds a child item to the start of this list.
 /// </summary>
 /// <param name="newItem">The menu item to insert</param>
 public void PrependChild(MenuItemModel newItem)
 {
     this._children.Insert(0, newItem);
     newItem.SetParent(this);
 }
Exemple #3
0
        private void InsertChildBefore(MenuItemModel childToInsert, MenuItemModel relativePositionMarker)
        {
            var index = this._children.IndexOf(relativePositionMarker);

            if (index > 0)
            {
                if (this._children[index - 1] is MenuSeparatorModel)
                {
                    index--;
                }
            }

            this._children.Insert(index, childToInsert);
            childToInsert.SetParent(this);
        }
Exemple #4
0
 /// <summary>
 /// Adds a child item to the end of this list.
 /// </summary>
 /// <param name="newItem">The menu item to insert</param>
 public void AppendChild(MenuItemModel newItem)
 {
     this._children.Add(newItem);
     newItem.SetParent(this);
 }