diff options
author | Eric Maupin <me@ermau.com> | 2019-01-24 22:01:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-24 22:01:41 +0300 |
commit | 79ab73f619509b14a19dc0774d6221b4115337c5 (patch) | |
tree | b86b9eb39e20269b68ccf111a07e0efac9268512 | |
parent | 21c98e48fc25619e7434045acf27c5963037fc77 (diff) | |
parent | b08c453dcd7558440d259ac86fae72fabd2ab699 (diff) |
Merge pull request #506 from xamarin/ermau-control-arrangemodes
Allow control over displayed arrange modes
-rw-r--r-- | Xamarin.PropertyEditing/TargetPlatform.cs | 14 | ||||
-rw-r--r-- | Xamarin.PropertyEditing/ViewModels/PanelViewModel.cs | 16 |
2 files changed, 25 insertions, 5 deletions
diff --git a/Xamarin.PropertyEditing/TargetPlatform.cs b/Xamarin.PropertyEditing/TargetPlatform.cs index 425bafd..be136d6 100644 --- a/Xamarin.PropertyEditing/TargetPlatform.cs +++ b/Xamarin.PropertyEditing/TargetPlatform.cs @@ -112,6 +112,15 @@ namespace Xamarin.PropertyEditing } /// <summary> + /// Gets or sets a list of the allowed arrange modes. + /// </summary> + public IReadOnlyList<PropertyArrangeMode> ArrangeModes + { + get; + set; + } = new[] { PropertyArrangeMode.Name, PropertyArrangeMode.Category }; + + /// <summary> /// Gets or sets a callback for errors that should be edge cases and/or don't have a defined way of displaying in the UI. /// </summary> /// <remarks> @@ -139,11 +148,14 @@ namespace Xamarin.PropertyEditing return new TargetPlatform (provider) { ResourceProvider = ResourceProvider, BindingProvider = BindingProvider, + IconProvider = IconProvider, SupportsMaterialDesign = SupportsMaterialDesign, SupportsCustomExpressions = SupportsCustomExpressions, SupportsBrushOpacity = SupportsBrushOpacity, GroupedTypes = GroupedTypes, - AutoExpandGroups = AutoExpandGroups + AutoExpandGroups = AutoExpandGroups, + ArrangeModes = ArrangeModes, + ErrorHandler = ErrorHandler }; } } diff --git a/Xamarin.PropertyEditing/ViewModels/PanelViewModel.cs b/Xamarin.PropertyEditing/ViewModels/PanelViewModel.cs index 25ff232..dfc818d 100644 --- a/Xamarin.PropertyEditing/ViewModels/PanelViewModel.cs +++ b/Xamarin.PropertyEditing/ViewModels/PanelViewModel.cs @@ -115,10 +115,18 @@ namespace Xamarin.PropertyEditing.ViewModels public PanelViewModel (TargetPlatform targetPlatform) : base (targetPlatform) { - ArrangeModes = new List<ArrangeModeViewModel> { - new ArrangeModeViewModel (PropertyArrangeMode.Name, this), - new ArrangeModeViewModel (PropertyArrangeMode.Category, this) - }; + if (targetPlatform == null) + throw new ArgumentNullException (nameof(targetPlatform)); + + var modes = new List<ArrangeModeViewModel> (); + if (targetPlatform.ArrangeModes == null || targetPlatform.ArrangeModes.Count == 0) + modes.Add (new ArrangeModeViewModel (PropertyArrangeMode.Name, this)); + else { + for (int i = 0; i < targetPlatform.ArrangeModes.Count; i++) + modes.Add (new ArrangeModeViewModel (targetPlatform.ArrangeModes[i], this)); + } + + ArrangeModes = modes; } public event EventHandler ArrangedPropertiesChanged; |