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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -