wpf - how do I loop through all controls on a popup -
i'm trying "part_headerbutton" datepicker
control , apply customized style. problem can't search visual tree find header button. calendar on popup. seems when popup opens new visual tree created.
my question how can access new generated visual tree , loop search?
private static ienumerable<t> findvisualchildren<t>(dependencyobject depobj) t : dependencyobject { if (depobj != null) { (int = 0; < visualtreehelper.getchildrencount(depobj); i++) { dependencyobject child = visualtreehelper.getchild(depobj, i); if (child != null && child t) { yield return (t)child; } foreach (t childofchild in findvisualchildren<t>(child)) { yield return childofchild; } } } }
this return list dependencyobjects of type passed t object passed parameter.
Comments
Post a Comment