ItemCollection.Clear Method ()

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Clears the collection and releases the references on all items currently in the collection.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

abstract Clear : unit -> unit
override Clear : unit -> unit

Implements

IList.Clear()

Exception Condition
InvalidOperationException

The ItemCollection is in ItemsSource mode. (When the ItemsSource property is set, the Items collection will be made read-only and fixed-size.)

The following example shows how to use this method. In the example, sbar is a StatusBar control, which is an ItemsControl.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.0
Return to top
Show: