Created
September 11, 2014 08:56
-
-
Save dunston/5bf73050b102933060ba to your computer and use it in GitHub Desktop.
Finding all sub controls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You maybe has to call EnsureChildControls first | |
public static Control[] FlattenHierachy(Control root) | |
{ | |
List<Control> list = new List<Control>(); | |
list.Add(root); | |
if (root.HasControls()) | |
{ | |
foreach (Control control in root.Controls) | |
{ | |
list.AddRange(FlattenHierachy(control)); | |
} | |
} | |
return list.ToArray(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment