mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix CaretBrush setter logic in theme styles
Fixed the logic for setting the CaretBrush property in styles to only add the setter if it does not already exist and a Foreground value is present. This removes unnecessary checks and setter removals, making the code more efficient and easier to maintain.
This commit is contained in:
parent
1dcaf3d359
commit
f5b8a87de4
1 changed files with 2 additions and 6 deletions
|
|
@ -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<Setter>().Where(x => x.Property == TextBoxBase.CaretBrushProperty).ToList();
|
||||
var caretBrushPropertyExist = style.Setters.OfType<Setter>().Any(x => x.Property == TextBoxBase.CaretBrushProperty);
|
||||
var foregroundPropertyValue = style.Setters.OfType<Setter>().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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue