I'm writing a Windows application for a client, and I've run into a problem
I don't know how to solve.
The UI is relatively simple - a listbox on the left (in a panel), and a
third-party tab control on the right (also in a panel). The usual splitter
bar, and all that good stuff. The tab control is set up to deal with
drag/drop events, so that users can drag an item from the listbox over the
tab control and have the tab control respond by either switching to the
appropriate tab page (if it's already created), or create a new one based on
the data dragged. The "guts" of the tab pages are in a single UserControl
that has all the functionality I need, and I create and add those
UserControls on the fly.
My problem is that, while I can easily set up the tab control to process the
drag/drop events, setting up the UserControl is not so easy. This
UserControl has several constituent controls, and since I'm adding the
control on the fly, I have to hook up the appropriate events on the fly as
well. But once a user drags the cursor over one of the constituent
controls, my on-the-fly-wired event doesn't see it, and the cursor changes
to the "you can't drop here" version.
How do I cascade the AddHandler wiring down to every constituent control in
the UserControl? I know that cascading events down the chain is technically
the wrong way, but I don't see how to set it up so that everything moves up.
What am I missing here?
TIA
- Scott