[Core] null/empty categories go on the bottom
This commit is contained in:
Родитель
78d9d43477
Коммит
a577f71a39
|
@ -0,0 +1,20 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Xamarin.PropertyEditing
|
||||||
|
{
|
||||||
|
internal class CategoryComparer
|
||||||
|
: IComparer<string>
|
||||||
|
{
|
||||||
|
public static readonly CategoryComparer Instance = new CategoryComparer();
|
||||||
|
|
||||||
|
public int Compare (string x, string y)
|
||||||
|
{
|
||||||
|
int result = Comparer<string>.Default.Compare (x, y);
|
||||||
|
if (result != 0 && (String.IsNullOrEmpty (x) || String.IsNullOrEmpty (y)))
|
||||||
|
result *= -1;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -96,7 +96,7 @@ namespace Xamarin.PropertyEditing.ViewModels
|
||||||
Dictionary<string, List<PropertyViewModel>> groupedTypeProperties = null;
|
Dictionary<string, List<PropertyViewModel>> groupedTypeProperties = null;
|
||||||
|
|
||||||
this.arranged.Clear ();
|
this.arranged.Clear ();
|
||||||
foreach (var grouping in props.GroupBy (GetGroup).OrderBy (g => g.Key)) {
|
foreach (var grouping in props.GroupBy (GetGroup).OrderBy (g => g.Key, CategoryComparer.Instance)) {
|
||||||
HashSet<EditorViewModel> remainingItems = null;
|
HashSet<EditorViewModel> remainingItems = null;
|
||||||
|
|
||||||
if (ArrangeMode == PropertyArrangeMode.Category) {
|
if (ArrangeMode == PropertyArrangeMode.Category) {
|
||||||
|
@ -126,7 +126,7 @@ namespace Xamarin.PropertyEditing.ViewModels
|
||||||
|
|
||||||
if (groupedTypeProperties != null) { // Insert type-grouped properties back in sorted.
|
if (groupedTypeProperties != null) { // Insert type-grouped properties back in sorted.
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (var kvp in groupedTypeProperties.OrderBy (kvp => kvp.Key)) {
|
foreach (var kvp in groupedTypeProperties.OrderBy (kvp => kvp.Key, CategoryComparer.Instance)) {
|
||||||
var group = new ObservableGrouping<string, EditorViewModel> (kvp.Key) {
|
var group = new ObservableGrouping<string, EditorViewModel> (kvp.Key) {
|
||||||
new PropertyGroupViewModel (kvp.Key, kvp.Value, ObjectEditors)
|
new PropertyGroupViewModel (kvp.Key, kvp.Value, ObjectEditors)
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
<Compile Include="AsyncWorkQueue.cs" />
|
<Compile Include="AsyncWorkQueue.cs" />
|
||||||
<Compile Include="BidirectionalDictionary.cs" />
|
<Compile Include="BidirectionalDictionary.cs" />
|
||||||
<Compile Include="BrushPropertyInfo.cs" />
|
<Compile Include="BrushPropertyInfo.cs" />
|
||||||
|
<Compile Include="CategoryComparer.cs" />
|
||||||
<Compile Include="Drawing\CommonAlignment.cs" />
|
<Compile Include="Drawing\CommonAlignment.cs" />
|
||||||
<Compile Include="Drawing\CommonBrush.cs" />
|
<Compile Include="Drawing\CommonBrush.cs" />
|
||||||
<Compile Include="Drawing\CommonBrushMappingMode.cs" />
|
<Compile Include="Drawing\CommonBrushMappingMode.cs" />
|
||||||
|
|
Загрузка…
Ссылка в новой задаче