Being relatively new to C#, I've been researching custom events recently, and while I think I now understand the basic pieces required to setup a custom event, I'm having trouble determining where each piece belongs. Specifically, here's what I'm trying to do.
I have a tree control that represents the layout of an internal data structure. When the data is rearranged in the tree (via drag/drop), I need to rearrange the underlying data structure to match.
So, I'm attempting to fire my own, custom event from within the "Drop" event handler of the tree control (after I've validated the drop). The idea being that a subscriber to my event would handle the reordering of the underlying data.
I'm just struggling to determine where each piece of event machinery should be created and/or used.
If someone could provide me with a basic sample of the above, that'd be great. For instance, maybe a simple example that sets up and fires a custom event from within an existing button_click event. That would seem to be a good simulation of what I'm trying to do.
Also, if my approach to the problem seems completely wrong, I'd like to know that also.