I am attempting to create a UserControl for a Windows Form in order to accomplish the following:
-The design surface of the user control only has a checkbox control on it.
-In the code-behind I added an Interface:
public partial class CodeGenCheckBox : UserControl, ICodeGenCheckBox
The interface is functioning as a sort of "tag" for the control, so that during run time type identification I can gather ALL the checkbox controls of type ICodeGenCheckBox into a List< > of type ICodeGenCheckBox, then loop through that list and do work.
Does the above approach sound workable?
Assuming for the moment that it is, what I am asking for is a method that I can call recursively that will iterate through ALL the controls and sub controls and sub sub controls (as deep as they are nested) on the form and in that recursive method call I want to add some logic that essentially says: "if the control you are looking at is of type ICodeGenCheckBox, then add the control to the List<ICodeGenCheckBox>"
I know I've asked a similar question before, but I can't find it in my knowledge base (yet). If I find it I'll come back here and post.
Solution code needs to be in C# for points on this question.