mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Improve style setter property checks for CaretBrush/Foreground
Updated logic to compare dependency property objects directly instead of using string property names when identifying and manipulating CaretBrush and Foreground setters. This enhances robustness and reduces risk of errors from string comparisons.
This commit is contained in:
parent
aff6b20aa0
commit
913ef1a0bd
1 changed files with 3 additions and 2 deletions
|
|
@ -217,9 +217,9 @@ namespace Flow.Launcher.Core.Resource
|
|||
style.Setters.Add(new Setter(Control.FontStretchProperty, fontStretch));
|
||||
|
||||
// Set caret brush (retain existing logic)
|
||||
var caretBrushProperty = style.Setters.OfType<Setter>().Where(x => x.Property.Name == "CaretBrush")?
|
||||
var caretBrushProperty = style.Setters.OfType<Setter>().Where(x => x.Property == TextBoxBase.CaretBrushProperty)?
|
||||
.FirstOrDefault();
|
||||
var foregroundPropertyValue = style.Setters.OfType<Setter>().Where(x => x.Property.Name == "Foreground")
|
||||
var foregroundPropertyValue = style.Setters.OfType<Setter>().Where(x => x.Property == Control.ForegroundProperty)
|
||||
.Select(x => x.Value).FirstOrDefault();
|
||||
if (caretBrushProperty != null && foregroundPropertyValue != null)
|
||||
{
|
||||
|
|
@ -245,6 +245,7 @@ namespace Flow.Launcher.Core.Resource
|
|||
style.Setters.Remove(setter);
|
||||
}
|
||||
|
||||
// Add New font setter
|
||||
style.Setters.Add(new Setter(TextBlock.FontFamilyProperty, fontFamily));
|
||||
style.Setters.Add(new Setter(TextBlock.FontStyleProperty, fontStyle));
|
||||
style.Setters.Add(new Setter(TextBlock.FontWeightProperty, fontWeight));
|
||||
|
|
|
|||
Loading…
Reference in a new issue