Working with UICollectionChangedEvent - harborsiem/WindowsRibbon GitHub Wiki
IUICollection Events Objects that implements IUICollection interface usually expose an OnChanged event that is called when the collection has changed due to: Insert item, Remove item, Replace item, Reset collection. This event is exposed using the standard COM events mechanism, namely: IConnectionPointContainer, IConnectionPoint and Advise(). To help the user to avoid these issues altogether, I’ve created the UICollectionChangedEvent class, which attaches to a given IUICollection and exposes the ChangedEvent event as a normal .NET event.
Constructors
Name | Description |
---|---|
UICollectionChangedEvent() | Initializes a new instance of the UICollectionChangedEvent class. |
Methods
Name | Description |
---|---|
Attach(IUICollection) | Attach to an IUICollection object events. |
Detach() | Detach from the previous IUICollection object events. |
Events
Name | Description |
---|---|
ChangedEvent | Occurs when the IUICollection was changed. |
In your EventHandler for the ChangedEvent you get the UICollectionChangedEventArgs class.
Properties
Name | Description |
---|---|
Action | Collection change action (Type: enum CollectionChange). |
OldIndex | The old index (Type: UInt32). |
OldItem | The old item (Type: Object). |
NewIndex | The new Index (Type: UInt32). |
NewItem | The new Item (Type: Object). |
Example: see description of the ComboBox