c# - Loop through Groupbox in TabControl -


i have wpf contain tab control (page1, page2, , page3).

in tab control page 2, have 3 groupbox (groupbox_a, groupbox_b, , groupbox_c), , each of groupbox contain 3 textbox.

may know c# code loop through textbox , clear content.

this function return textboxes within tab control.

public 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;             }         }     } } 

you can text boxes enumerating :

foreach (var textbox in findvisualchildren<textbox>(window)) {     // tb here } 

source : find controls in wpf window type


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -