From 18099cd77ced84c7672ffd3db5bf51666c50f338 Mon Sep 17 00:00:00 2001 From: OliverT87 Date: Sat, 21 Jun 2025 13:16:44 +0200 Subject: [PATCH] alle warnungen (2) beseitigt --- Project_Periodensystem.View/MainWindow.axaml.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Project_Periodensystem.View/MainWindow.axaml.cs b/Project_Periodensystem.View/MainWindow.axaml.cs index a7f7a1d..e301f6c 100644 --- a/Project_Periodensystem.View/MainWindow.axaml.cs +++ b/Project_Periodensystem.View/MainWindow.axaml.cs @@ -58,9 +58,14 @@ namespace Project_Periodensystem.View // Update text colors for all direct TextBlocks foreach (var textBlock in control.GetVisualDescendants().OfType()) { - if (textBlock.Parent is Button || textBlock.Parent.ToString().Contains("ElementTile")) + var parent = textBlock.Parent; + if (parent == null || + parent is Button || + parent?.GetType().ToString().Contains("ElementTile") == true) + { continue; - + } + textBlock.Foreground = new SolidColorBrush(Color.Parse(foreground)); } }