diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index 3d1e89a11..7e9c3bf11 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -218,15 +218,11 @@ namespace Flow.Launcher.Core.Resource style.Setters.Add(new Setter(Control.FontStretchProperty, fontStretch)); // Set caret brush (retain existing logic) - var caretBrushPropertySetters = style.Setters.OfType().Where(x => x.Property == TextBoxBase.CaretBrushProperty).ToList(); + var caretBrushPropertyExist = style.Setters.OfType().Any(x => x.Property == TextBoxBase.CaretBrushProperty); var foregroundPropertyValue = style.Setters.OfType().Where(x => x.Property == Control.ForegroundProperty) .Select(x => x.Value).FirstOrDefault(); - if (caretBrushPropertySetters.Count > 0 && foregroundPropertyValue != null) + if (!caretBrushPropertyExist && foregroundPropertyValue != null) { - foreach (var setter in caretBrushPropertySetters) - { - style.Setters.Remove(setter); - } style.Setters.Add(new Setter(TextBoxBase.CaretBrushProperty, foregroundPropertyValue)); } }