Categories
How to check multiple elements for an empty string in WPF?
Good afternoon! In my WPF project, there are several TextBlocks included in a StackPanel (Name = MainPanel), how can I loop through all of them for an empty string?
Answer the question
In order to leave comments, you need to log in
bool isEmpty = MainPanel.Children .OfType<TextBlock>() .Any(s => string.IsNullOrWhiteSpace(s.Text));
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question