alle warnungen (2) beseitigt

This commit is contained in:
OliverT87 2025-06-21 13:16:44 +02:00
parent fa43a710ab
commit 18099cd77c

View File

@ -58,9 +58,14 @@ namespace Project_Periodensystem.View
// Update text colors for all direct TextBlocks // Update text colors for all direct TextBlocks
foreach (var textBlock in control.GetVisualDescendants().OfType<TextBlock>()) foreach (var textBlock in control.GetVisualDescendants().OfType<TextBlock>())
{ {
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; continue;
}
textBlock.Foreground = new SolidColorBrush(Color.Parse(foreground)); textBlock.Foreground = new SolidColorBrush(Color.Parse(foreground));
} }
} }