diff options
author | Mike Krüger <mikkrg@microsoft.com> | 2022-02-02 13:08:55 +0300 |
---|---|---|
committer | Mike Krüger <mikkrg@microsoft.com> | 2022-02-03 11:37:22 +0300 |
commit | c0f4d68b053b50e9157fbfef150e4589c1f3100e (patch) | |
tree | 22d3784f6e0dfe71c41e2d10cab14bce825d1928 | |
parent | bb51ee49a85a34fb86c9da12473a62fa241f0613 (diff) |
Fixed NSColor dispose side effect.
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1455310
Bug 1455310: [Feedback] Editor theme is not correctly updated when the theme changes (VS for Mac 2022 Preview 4)
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/DynamicBox.cs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/DynamicBox.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/DynamicBox.cs index 7a6aedd..d836877 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/DynamicBox.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/DynamicBox.cs @@ -14,14 +14,14 @@ namespace Xamarin.PropertyEditing.Mac BorderWidth = 0; BoxType = NSBoxType.NSBoxCustom; TranslatesAutoresizingMaskIntoConstraints = false; - + this.WantsLayer = true; this.fillColor = fillName; if (fillName == null) - FillColor = NSColor.Clear; + this.Layer.BackgroundColor = NSColor.Clear.CGColor; this.borderColor = borderName; if (borderName == null) - BorderColor = NSColor.Clear; + this.Layer.BorderColor = NSColor.Clear.CGColor; HostResourceProvider = hostResources; } @@ -43,7 +43,7 @@ namespace Xamarin.PropertyEditing.Mac { this.fillColor = value; if (value == null) - FillColor = NSColor.Clear; + this.Layer.BackgroundColor = NSColor.Clear.CGColor; AppearanceChanged (); } @@ -56,7 +56,7 @@ namespace Xamarin.PropertyEditing.Mac { this.borderColor = value; if (value == null) - BorderColor = NSColor.Clear; + this.Layer.BorderColor = NSColor.Clear.CGColor; AppearanceChanged (); } @@ -78,16 +78,14 @@ namespace Xamarin.PropertyEditing.Mac NSColor color = this.hostResources.GetNamedColor (this.fillColor); if (color == null) return; - - FillColor = color; + this.Layer.BackgroundColor = color.CGColor; } if (this.borderColor != null) { NSColor color = this.hostResources.GetNamedColor (this.borderColor); if (color == null) return; - - BorderColor = color; + this.Layer.BorderColor = color.CGColor; } } } |