ControlUtils: Fix FinAllChildren

This commit is contained in:
2023-09-28 20:03:00 +02:00
parent ca1b68aa4f
commit 3be6371be1
2 changed files with 6 additions and 2 deletions

View File

@ -157,9 +157,12 @@ namespace Elwig {
protected void OnPrintingReadyChanged(EventArgs evt) { protected void OnPrintingReadyChanged(EventArgs evt) {
foreach (Window w in Windows) { foreach (Window w in Windows) {
foreach (var b in ControlUtils.FindAllChildren<Button>(w).Where(b => "Print".Equals(b.Tag))) { foreach (var b in ControlUtils.FindAllChildren<Button>(w).Where(b => b.Tag?.ToString() == "Print")) {
b.IsEnabled = IsPrintingReady; b.IsEnabled = IsPrintingReady;
} }
foreach (var i in ControlUtils.FindAllChildren<MenuItem>(w).Where(i => i.Tag?.ToString() == "Print")) {
i.IsEnabled = IsPrintingReady;
}
} }
} }
} }

View File

@ -58,7 +58,8 @@ namespace Elwig.Helpers {
continue; continue;
} else if (child is T t) { } else if (child is T t) {
yield return t; yield return t;
} else if (child is DependencyObject childDepOpj) { }
if (child is DependencyObject childDepOpj) {
foreach (T childOfChild in FindAllChildren<T>(childDepOpj)) { foreach (T childOfChild in FindAllChildren<T>(childDepOpj)) {
yield return childOfChild; yield return childOfChild;
} }