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)); } }