Reputation: 1107
I would like to check if exists any empty textBox on my Window. I found pretty nice solution for windowForms
if(this.Controls.OfType<TextBox>().Any(t => string.IsNullOrEmpty(t.Text)) {
...
}
by @StriplingWarrior
What is equivalent of this.Control in WPF? How to solve it in smart way?
Upvotes: 1
Views: 178
Reputation: 179
try this
LogicalTreeHelper.GetChildren(p_Parent).OfType<TextBox>().ToList().Where(d => string.IsNullOrWhiteSpace(d.Text)).ToList();
I have used it various places. Hope it helps.
Upvotes: 1