I'm programming in c#(WPF). I have a lot of nested controls
. I want to clear all
of my TextBox control which are in my application. It is very hard to access them by their name. Is there any way to access them recursively
and clear them?
for example some thing like this:
public void ClearAll(Control c)
{
if(c is TextBox)
{
((TextBox)c).Clear();
return;
}
foreach(Control child in GetChild(c))
{
ClearAll(child);
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…