/// <summary> /// Gets called after a new item was added to a collection. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="args">Informations about the event.</param> private void field_ItemAdded(object sender, ObjectFieldEventArgs args) { ObjectFieldCollection collection = args.ObjectField.Parent as ObjectFieldCollection; if (collection != null) { Dirty = true; TreePath parentPath = GetPath(collection); ObjectFieldList listField = collection as ObjectFieldList; int index = collection.Count; if (listField != null) { index = listField.Items.IndexOf(args.ObjectField); } OnNodesInserted(new TreeModelEventArgs(parentPath, new[] { index }, new object[] { args.ObjectField })); treeView.FindNode(parentPath).Expand(); OnItemAdded(args); } }