diff options
author | Dominique Louis <savagesoftware@gmail.com> | 2019-09-04 17:13:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-04 17:13:23 +0300 |
commit | 795ddb5e0fecb13522993473d74f6f1b4b4c2755 (patch) | |
tree | 7e59c7880babdc90b3abfd0257424abd13139ec0 | |
parent | 0ab6bd4cf3d1b371dfda5443a2814f7406b81ce0 (diff) | |
parent | ff3404112a8176469efe279b0d0fbc2453842a15 (diff) |
Merge pull request #623 from xamarin/ermau-fix-604
[mac] Fix timing of appearance changes for popovers
3 files changed, 12 insertions, 7 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/AutoClosePopOver.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/AutoClosePopOver.cs index e079f3f..f3a25ac 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/AutoClosePopOver.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/AutoClosePopOver.cs @@ -9,7 +9,7 @@ namespace Xamarin.PropertyEditing.Mac public bool CloseOnEnter { get; internal set; } - public AutoClosePopOver (IHostResourceProvider hostResources) : base () + public AutoClosePopOver (IHostResourceProvider hostResources, NSAppearance effectiveAppearance) { if (hostResources == null) throw new ArgumentNullException (nameof (hostResources)); @@ -19,7 +19,7 @@ namespace Xamarin.PropertyEditing.Mac Behavior = NSPopoverBehavior.Semitransient; CloseOnEnter = true; - this.SetAppearance (this.hostResources.GetVibrantAppearance (EffectiveAppearance)); + this.SetAppearance (this.hostResources.GetVibrantAppearance (effectiveAppearance)); } public override void KeyUp (NSEvent theEvent) diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/BasePopOverControl.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/BasePopOverControl.cs index d705b9e..e4bea5e 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/BasePopOverControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/BasePopOverControl.cs @@ -51,9 +51,7 @@ namespace Xamarin.PropertyEditing.Mac NSLayoutConstraint.Create (this.viewTitle, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, PropertyEditorControl.DefaultControlHeight), }); - this.SetAppearance (hostResources.GetVibrantAppearance (EffectiveAppearance)); - - ViewDidChangeEffectiveAppearance (); + AppearanceChanged (); } protected IHostResourceProvider HostResources @@ -64,6 +62,13 @@ namespace Xamarin.PropertyEditing.Mac public override void ViewDidChangeEffectiveAppearance () { + base.ViewDidChangeEffectiveAppearance (); + AppearanceChanged (); + } + + protected void AppearanceChanged() + { + this.SetAppearance (HostResources.GetVibrantAppearance (EffectiveAppearance)); this.viewTitle.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor); } } diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs index 7e8b6bc..989cad7 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs @@ -256,7 +256,7 @@ namespace Xamarin.PropertyEditing.Mac Appearance = EffectiveAppearance }; - var customExpressionPopOver = new AutoClosePopOver(this.hostResources) { + var customExpressionPopOver = new AutoClosePopOver (this.hostResources, EffectiveAppearance) { CloseOnEnter = false, ContentViewController = new NSViewController (null, null) { View = customExpressionView }, }; @@ -272,7 +272,7 @@ namespace Xamarin.PropertyEditing.Mac Appearance = EffectiveAppearance }; - var resourceSelectorPopOver = new AutoClosePopOver(this.hostResources) { + var resourceSelectorPopOver = new AutoClosePopOver (this.hostResources, EffectiveAppearance) { ContentViewController = new NSViewController (null, null) { View = requestResourceView }, }; |