示例#1
0
		/// <summary>
		/// Add the given collection of model objects to this control.
		/// </summary>
		/// <param name="modelObjects">A collection of model objects</param>
		/// <remarks>
		/// <para>The added objects will appear in their correct sort position, if sorting
		/// is active. Otherwise, they will appear at the end of the list.</para>
		/// <para>No check is performed to see if any of the objects are already in the ListView.</para>
		/// <para>Null objects are silently ignored.</para>
		/// </remarks>
		public override void AddObjects(ICollection modelObjects) {
			if (this.DataSource == null)
				return;

			// Give the world a chance to cancel or change the added objects
			ItemsAddingEventArgs args = new ItemsAddingEventArgs(modelObjects);
			this.OnItemsAdding(args);
			if (args.Canceled)
				return;

			this.ClearCachedInfo();
			this.DataSource.AddObjects(args.ObjectsToAdd);
			this.Sort();
			this.UpdateVirtualListSize();
		}
示例#2
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="e"></param>
		protected virtual void OnItemsAdding(ItemsAddingEventArgs e) {
			if (this.ItemsAdding != null)
				this.ItemsAdding(this, e);
		}