System.Windows.Forms.ListView.ListViewItemCollection.Clear C# (CSharp) Method

Clear() public method

public Clear ( ) : void
return void
			public virtual void Clear ()
			{
				if (owner != null && owner.VirtualMode)
					throw new InvalidOperationException ();
				if (is_main_collection && owner != null) {
					owner.SetFocusedItem (-1);
					owner.h_scroll.Value = owner.v_scroll.Value = 0;

					// first remove any item in the groups that *are* part of this LV too
					foreach (ListViewGroup group in owner.groups)
						group.Items.ClearItemsWithSameListView ();
				
					foreach (ListViewItem item in list) {
						owner.item_control.CancelEdit (item);
						item.Owner = null;
					}
				}
				else
					foreach (ListViewItem item in list)
						item.SetGroup (null);

				list.Clear ();
				CollectionChanged (false);

				//UIA Framework event: Items Removed
				OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Refresh, null));

			}