diff options
author | Dominique Louis <dominique@cnlilyzhou.fareast.corp.microsoft.com> | 2019-02-22 13:03:19 +0300 |
---|---|---|
committer | Dominique Louis <dominique@satoshy-sb1.fareast.corp.microsoft.com> | 2019-03-02 15:45:48 +0300 |
commit | 6b2b898b76a4ab942d8cdc415a84205805c750ba (patch) | |
tree | 9c8319d18b843b5db00f4ef224bf751c0c4a301c /Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs | |
parent | 1b4da57c501b14b295a90f0a57aea526ba637dc5 (diff) |
Enabled must be set for ReadOnly to look right. Also fixes InputMode enablement.
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs index 05b2463..7af5487 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs @@ -59,6 +59,8 @@ namespace Xamarin.PropertyEditing.Mac public override NSView FirstKeyView => NumericEditor; public override NSView LastKeyView => NumericEditor.DecrementButton; + private bool CanEnable => ViewModel.Property.CanWrite && (((ViewModel.InputMode != null) && !ViewModel.InputMode.IsSingleValue) || (this.inputModePopup == null)); + protected NSNumberFormatterStyle NumberStyle { get { return NumericEditor.NumberStyle; } @@ -91,7 +93,7 @@ namespace Xamarin.PropertyEditing.Mac protected override void SetEnabled () { - NumericEditor.Editable = ViewModel.Property.CanWrite; + NumericEditor.Enabled = CanEnable; if (this.inputModePopup != null) this.inputModePopup.Enabled = ViewModel.Property.CanWrite; } @@ -108,7 +110,7 @@ namespace Xamarin.PropertyEditing.Mac { if (this.underlyingType != null) { NumericEditor.StringValue = ViewModel.Value == null ? string.Empty : ViewModel.Value.ToString (); - NumericEditor.Enabled = ((ViewModel.InputMode != null) && !ViewModel.InputMode.IsSingleValue) || (this.inputModePopup == null); + NumericEditor.Enabled = CanEnable; if (this.inputModePopup != null) this.inputModePopup.SelectItem ((ViewModel.InputMode == null) ? string.Empty : ViewModel.InputMode.Identifier); @@ -126,7 +128,7 @@ namespace Xamarin.PropertyEditing.Mac NumericEditor.AccessibilityTitle = string.Format (LocalizationResources.AccessibilityNumeric, ViewModel.Property.Name); if (this.inputModePopup != null) { - this.inputModePopup.AccessibilityEnabled = NumericEditor.Enabled; + this.inputModePopup.AccessibilityEnabled = this.inputModePopup.Enabled; this.inputModePopup.AccessibilityTitle = string.Format (LocalizationResources.AccessibilityInpueModeEditor, ViewModel.Property.Name); } } @@ -174,6 +176,8 @@ namespace Xamarin.PropertyEditing.Mac // If we are reusing the control we'll have to hid the inputMode if this doesn't have InputMode. if (this.inputModePopup != null) this.inputModePopup.Hidden = !ViewModel.HasInputModes; + + SetEnabled (); } } } |