/// <summary>
		/// Remove all of the given objects from the control
		/// </summary>
		/// <param name="modelObjects">Collection of objects to be removed</param>
		/// <remarks>
		/// <para>Nulls and model objects that are not in the ListView are silently ignored.</para>
		/// <para>Due to problems in the underlying ListView, if you remove all the objects from
		/// the control using this method and the list scroll vertically when you do so,
		/// then when you subsequenially add more objects to the control,
		/// the vertical scroll bar will become confused and the control will draw one or more
		/// blank lines at the top of the list. </para>
		/// </remarks>
		public override void RemoveObjects(ICollection modelObjects) {
			if (this.DataSource == null)
				return;

			// Give the world a chance to cancel or change the removed objects
			ItemsRemovingEventArgs args = new ItemsRemovingEventArgs(modelObjects);
			this.OnItemsRemoving(args);
			if (args.Canceled)
				return;

			this.ClearCachedInfo();
			this.DataSource.RemoveObjects(args.ObjectsToRemove);
			this.UpdateVirtualListSize();
		}
Beispiel #2
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="e"></param>
		protected virtual void OnItemsRemoving(ItemsRemovingEventArgs e) {
			if (this.ItemsRemoving != null)
				this.ItemsRemoving(this, e);
		}