1

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.