diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ColorFormatModel.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ColorFormatModel.cs
index 46357c8dde..1183b2aed3 100644
--- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ColorFormatModel.cs
+++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ColorFormatModel.cs
@@ -12,6 +12,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library
private string _name;
private string _example;
private bool _isShown;
+ private bool _canMoveUp = true;
+ private bool _canMoveDown = true;
public ColorFormatModel(string name, string example, bool isShown)
{
@@ -62,6 +64,34 @@ namespace Microsoft.PowerToys.Settings.UI.Library
}
}
+ public bool CanMoveUp
+ {
+ get
+ {
+ return _canMoveUp;
+ }
+
+ set
+ {
+ _canMoveUp = value;
+ OnPropertyChanged();
+ }
+ }
+
+ public bool CanMoveDown
+ {
+ get
+ {
+ return _canMoveDown;
+ }
+
+ set
+ {
+ _canMoveDown = value;
+ OnPropertyChanged();
+ }
+ }
+
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/ColorPickerViewModel.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/ColorPickerViewModel.cs
index e18aa2bc8b..d7c02b6b08 100644
--- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/ColorPickerViewModel.cs
+++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/ViewModels/ColorPickerViewModel.cs
@@ -247,11 +247,28 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
ColorFormats.Add(remainingColorFormat);
}
+ // Reordering colors with buttons: disable first and last buttons
+ ColorFormats[0].CanMoveUp = false;
+ ColorFormats[ColorFormats.Count - 1].CanMoveDown = false;
+
ColorFormats.CollectionChanged += ColorFormats_CollectionChanged;
}
private void ColorFormats_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
+ // Reordering colors with buttons: update buttons availability depending on order
+ if (ColorFormats.Count > 0)
+ {
+ foreach (var color in ColorFormats)
+ {
+ color.CanMoveUp = true;
+ color.CanMoveDown = true;
+ }
+
+ ColorFormats[0].CanMoveUp = false;
+ ColorFormats[ColorFormats.Count - 1].CanMoveDown = false;
+ }
+
UpdateColorFormats();
ScheduleSavingOfSettings();
}
diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw
index e2285b69ec..9cc66b5d46 100644
--- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw
+++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw
@@ -868,7 +868,7 @@
Open directly into the editor mode
- Editor color formats (Change the order by dragging)
+ Editor color formats
Show color name
@@ -1170,4 +1170,10 @@ Win + Shift + O to toggle your video
Plugins are loading...
+
+ Move the color down
+
+
+ Move the color up
+
\ No newline at end of file
diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml
index 65f04d7759..b44eee7498 100644
--- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml
+++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml
@@ -1,4 +1,4 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -179,8 +196,13 @@
Grid.Row="1"
Margin="0,0,0,8"/>
+ HorizontalAlignment="Right"
+ Margin="0,0,-36,0"/>
+
+
+
+
diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml.cs
index 569f45aa21..9ef3a0f604 100644
--- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml.cs
+++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml.cs
@@ -47,5 +47,35 @@ namespace Microsoft.PowerToys.Settings.UI.Views
ColorPicker_ComboBox.SelectedIndex = index;
}
+
+ private void ReorderButtonUp_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
+ {
+ ColorFormatModel color = ((Button)sender).DataContext as ColorFormatModel;
+ if (color == null)
+ {
+ return;
+ }
+
+ var index = ViewModel.ColorFormats.IndexOf(color);
+ if (index > 0)
+ {
+ ViewModel.ColorFormats.Move(index, index - 1);
+ }
+ }
+
+ private void ReorderButtonDown_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
+ {
+ ColorFormatModel color = ((Button)sender).DataContext as ColorFormatModel;
+ if (color == null)
+ {
+ return;
+ }
+
+ var index = ViewModel.ColorFormats.IndexOf(color);
+ if (index < ViewModel.ColorFormats.Count - 1)
+ {
+ ViewModel.ColorFormats.Move(index, index + 1);
+ }
+ }
}
}