Skip to content

Commit dcdc525

Browse files
committed
code_review: PR #1423
Since we have already used `OnPropertyChanged`, move `ActualThemeVariantProperty` changed handler into it Signed-off-by: leo <[email protected]>
1 parent e28b537 commit dcdc525

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Views/ChangeStatusIcon.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ public Models.Change Change
4242
set => SetValue(ChangeProperty, value);
4343
}
4444

45-
public ChangeStatusIcon()
46-
{
47-
ActualThemeVariantChanged += (_, _) => InvalidateVisual();
48-
}
49-
5045
public override void Render(DrawingContext context)
5146
{
5247
if (Change == null || Bounds.Width <= 0)
@@ -87,7 +82,9 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang
8782
{
8883
base.OnPropertyChanged(change);
8984

90-
if (change.Property == IsUnstagedChangeProperty || change.Property == ChangeProperty)
85+
if (change.Property == IsUnstagedChangeProperty ||
86+
change.Property == ChangeProperty ||
87+
(change.Property.Name == "ActualThemeVariant" && change.NewValue != null))
9188
InvalidateVisual();
9289
}
9390
}

0 commit comments

Comments
 (0)