Description
The OnItemRemoved
property is an event handler in the SelectionSystem
class. It is triggered whenever an item is removed from the selection system. This property allows you to assign a callback function that will be executed with the removed item as its parameter.
Usage
To use the OnItemRemoved
property, assign a method that matches the Action<object>
delegate signature. This method will be called whenever an item is removed from the selection system.
Example
// Example of using the OnItemRemoved property
// Create an instance of the SelectionSystem
SelectionSystem selectionSystem = new SelectionSystem();
// Define a method to handle the item removal
void ItemRemovedHandler(object removedItem)
{
// Handle the removed item
// For example, log the removed item
Log.Info($"Item removed: {removedItem}");
}
// Assign the handler to the OnItemRemoved event
selectionSystem.OnItemRemoved = ItemRemovedHandler;
// Add and remove items to trigger the event
selectionSystem.Add("Item1");
selectionSystem.Remove("Item1");
// Output: "Item removed: Item1"