ObservableCollection Class
Represents a dynamic data collection that provides notifications when items get added or removed. It is frequently used in data binding to display a collection of records within an ItemsControl such as a ListBox, ListView or TreeView.
<ListBox Width="200"
ItemsSource="{Binding Source={StaticResource NameListData}}"
ItemTemplate="{StaticResource NameItemTemplate}" />
Methods
From Collection
Name | Description |
---|---|
Add | Adds an item to the collection |
Clear | Removes all elements from the collection |
Contains | Determines whether the collection contains a specific item |
Count | Gets the number of items in the collection |
Get | Gets or sets the item at the specified index |
IndexOf | Determines the index of a specific item in the collection |
Insert | Inserts an item to the collection at the specified index |
Remove | Removes the first occurrence of a specific item from the collection |
RemoveAt | Removes the collection item at the specified index |
Properties
ObservableCollection has no properties
Events
ObservableCollection has no events