/// <summary> /// Fires the <see cref="SelectionChanged"/> event. /// </summary> /// <param name="args">Information about the event.</param> protected void OnSelectionChanged(ObjectFieldEventArgs args) { if (SelectionChanged != null) { SelectionChanged(this, args); } }
/// <summary> /// Fires the <see cref="ItemRemoved"/> event. /// </summary> /// <param name="args">More information about the event.</param> protected void OnItemRemoved(ObjectFieldEventArgs args) { if (ItemRemoved != null) { ItemRemoved(this, args); } }
/// <summary> /// Fires the <see cref="Collapsed"/> event. /// </summary> /// <param name="args">Information about the event.</param> protected void OnCollapsed(ObjectFieldEventArgs args) { if (Collapsed != null) { Collapsed(this, args); } }
/// <summary> /// Fires the <see cref="Expanded"/> event. /// </summary> /// <param name="args">Information about the event.</param> protected void OnExpanded(ObjectFieldEventArgs args) { if (Expanded != null) { Expanded(this, args); } }
/// <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); } }
/// <summary> /// Gets called after an item was removed from a collection. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="args">Informations about the event.</param> private void field_ItemRemoved(object sender, ObjectFieldEventArgs args) { Dirty = true; OnNodesRemoved(new TreeModelEventArgs(GetPath(args.ObjectField.Parent), new object[] { args.ObjectField })); OnItemRemoved(args); }
/// <summary> /// Gets called after a field was removed from a collection field. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e">Information about the event.</param> void treeModel_ItemRemoved(object sender, ObjectFieldEventArgs e) { OnValueChanged(new ValueChangedEventArgs(e.ObjectField, null, e.ObjectField)); }