Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Maupin <ermaup@microsoft.com>2019-01-29 22:10:03 +0300
committerEric Maupin <ermaup@microsoft.com>2019-01-29 22:10:05 +0300
commit78f6f4722673287a2641c0ec5cfa7b3ea4244371 (patch)
tree0cdf96ff8c08b7a5808f70be8f5c5ae9a537cbaa /Xamarin.PropertyEditing.Mac/Controls/Custom
parent33c8c865c7caf5804311a215db5935e4ac3ab366 (diff)
[mac] Fix editor panel theme handling
DynamicFillBox now allows for colors to be not found, sort of a hack fix to deal with the fact that we allow PropertyEditorPanel to be used in xibs, so we can't demand a IHostResourceProvider in the ctor, we have to accept it later. This also fixes the fact that the header theming wouldn't update when the resource provider changes.
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/Custom')
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/DynamicFillBox.cs24
1 files changed, 20 insertions, 4 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/DynamicFillBox.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/DynamicFillBox.cs
index 800d1c2..a542b5d 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/DynamicFillBox.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/DynamicFillBox.cs
@@ -8,7 +8,9 @@ namespace Xamarin.PropertyEditing.Mac
{
public DynamicFillBox (IHostResourceProvider hostResources, string colorName)
{
- this.hostResources = hostResources;
+ if (hostResources == null)
+ throw new ArgumentNullException (nameof (hostResources));
+
BorderWidth = 0;
BoxType = NSBoxType.NSBoxCustom;
TranslatesAutoresizingMaskIntoConstraints = false;
@@ -16,7 +18,17 @@ namespace Xamarin.PropertyEditing.Mac
if (colorName == null)
FillColor = NSColor.Clear;
- ViewDidChangeEffectiveAppearance ();
+ HostResourceProvider = hostResources;
+ }
+
+ public IHostResourceProvider HostResourceProvider
+ {
+ get { return this.hostResources; }
+ set
+ {
+ this.hostResources = value;
+ ViewDidChangeEffectiveAppearance ();
+ }
}
public string FillColorName
@@ -37,10 +49,14 @@ namespace Xamarin.PropertyEditing.Mac
if (this.colorName == null)
return;
- FillColor = this.hostResources.GetNamedColor (this.colorName);
+ NSColor color = this.hostResources.GetNamedColor (this.colorName);
+ if (color == null)
+ return;
+
+ FillColor = color;
}
- private readonly IHostResourceProvider hostResources;
+ private IHostResourceProvider hostResources;
private string colorName;
}
}