diff --git a/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs b/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs index 8e74659f4..a184b9cf0 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs @@ -39,14 +39,22 @@ protected override void OnViewModelChanged (PropertyViewModel oldModel) this.popupButtonList.RemoveAllItems (); foreach (var item in ViewModel.PossibleValues) { - this.popupButtonList.AddItem (new NSMenuItem (item)); + if (!string.IsNullOrEmpty (ViewModel.SeparatorString) && ViewModel.SeparatorString == item) { + this.popupButtonList.AddItem (NSMenuItem.SeparatorItem); + } else { + this.popupButtonList.AddItem (new NSMenuItem (item)); + } } } else { RequireComboBox (); this.comboBox.RemoveAll (); foreach (var item in ViewModel.PossibleValues) { - this.comboBox.Add (new NSString (item)); + if (!string.IsNullOrEmpty (ViewModel.SeparatorString) && ViewModel.SeparatorString == item) { + this.comboBox.Add (NSMenuItem.SeparatorItem); + } else { + this.comboBox.Add (new NSString (item)); + } } } diff --git a/Xamarin.PropertyEditing/IHavePredefinedValues.cs b/Xamarin.PropertyEditing/IHavePredefinedValues.cs index 34b7c5fb2..6debc97e3 100644 --- a/Xamarin.PropertyEditing/IHavePredefinedValues.cs +++ b/Xamarin.PropertyEditing/IHavePredefinedValues.cs @@ -21,6 +21,8 @@ public interface IHavePredefinedValues /// bool IsValueCombinable { get; } + string SeparatorString { get; } + IReadOnlyDictionary PredefinedValues { get; } } } \ No newline at end of file diff --git a/Xamarin.PropertyEditing/Reflection/ReflectionEnumPropertyInfo.cs b/Xamarin.PropertyEditing/Reflection/ReflectionEnumPropertyInfo.cs index 93bfd963e..7f7bd487b 100644 --- a/Xamarin.PropertyEditing/Reflection/ReflectionEnumPropertyInfo.cs +++ b/Xamarin.PropertyEditing/Reflection/ReflectionEnumPropertyInfo.cs @@ -44,6 +44,8 @@ public IReadOnlyDictionary PredefinedValues get; } + public string SeparatorString { get; } + #pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously public override async Task SetValueAsync (object target, TValue value) { diff --git a/Xamarin.PropertyEditing/ViewModels/PredefinedValuesViewModel.cs b/Xamarin.PropertyEditing/ViewModels/PredefinedValuesViewModel.cs index f817998fc..efcfd5331 100644 --- a/Xamarin.PropertyEditing/ViewModels/PredefinedValuesViewModel.cs +++ b/Xamarin.PropertyEditing/ViewModels/PredefinedValuesViewModel.cs @@ -41,6 +41,8 @@ public string ValueName set { SetValueName (value); } } + public string SeparatorString => this.predefinedValues.SeparatorString; + public bool IsConstrainedToPredefined => this.predefinedValues.IsConstrainedToPredefined; protected override TValue CoerceValue (TValue validationValue)