Skip to content
This repository was archived by the owner on Sep 25, 2024. It is now read-only.

Commit b08c453

Browse files
author
Eric Maupin
committed
[Core] Allow TargetPlatform to specify arrange modes
1 parent 5501d90 commit b08c453

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

Xamarin.PropertyEditing/TargetPlatform.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,15 @@ public IReadOnlyCollection<string> AutoExpandGroups
111111
set;
112112
}
113113

114+
/// <summary>
115+
/// Gets or sets a list of the allowed arrange modes.
116+
/// </summary>
117+
public IReadOnlyList<PropertyArrangeMode> ArrangeModes
118+
{
119+
get;
120+
set;
121+
} = new[] { PropertyArrangeMode.Name, PropertyArrangeMode.Category };
122+
114123
/// <summary>
115124
/// 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.
116125
/// </summary>
@@ -145,6 +154,7 @@ internal TargetPlatform WithProvider (IEditorProvider provider)
145154
SupportsBrushOpacity = SupportsBrushOpacity,
146155
GroupedTypes = GroupedTypes,
147156
AutoExpandGroups = AutoExpandGroups,
157+
ArrangeModes = ArrangeModes,
148158
ErrorHandler = ErrorHandler
149159
};
150160
}

Xamarin.PropertyEditing/ViewModels/PanelViewModel.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,18 @@ internal class PanelViewModel
115115
public PanelViewModel (TargetPlatform targetPlatform)
116116
: base (targetPlatform)
117117
{
118-
ArrangeModes = new List<ArrangeModeViewModel> {
119-
new ArrangeModeViewModel (PropertyArrangeMode.Name, this),
120-
new ArrangeModeViewModel (PropertyArrangeMode.Category, this)
121-
};
118+
if (targetPlatform == null)
119+
throw new ArgumentNullException (nameof(targetPlatform));
120+
121+
var modes = new List<ArrangeModeViewModel> ();
122+
if (targetPlatform.ArrangeModes == null || targetPlatform.ArrangeModes.Count == 0)
123+
modes.Add (new ArrangeModeViewModel (PropertyArrangeMode.Name, this));
124+
else {
125+
for (int i = 0; i < targetPlatform.ArrangeModes.Count; i++)
126+
modes.Add (new ArrangeModeViewModel (targetPlatform.ArrangeModes[i], this));
127+
}
128+
129+
ArrangeModes = modes;
122130
}
123131

124132
public event EventHandler ArrangedPropertiesChanged;

0 commit comments

Comments
 (0)