Is it possible to detect whether a control has been got focus in a user control? I mean not some controls that we add in a user control at its design time rather which controls we add them after using user control on the form. A mean example is panels. My user control acts like as a panel and I want to detect when a contained(nested) control on my user control got any focus I do my thing.
Thank ya all!
The way that I would approach this is when the UserControl is created and you are not in design mode, cycle through each of the controls within the user control adding hooks to their GotFocus events and pointing the hook to a method of the UserControl (say ChildControlGotFocus) that in turn raises an event that host of the user control can use.
For example, here is a sample UserControl that implements this functionality: