mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
ColorPickerControl finally doesn't set database to dirty when there is an initial value
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using ModernKeePass.ViewModels;
|
||||
|
||||
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
@@ -11,13 +10,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
{
|
||||
public sealed partial class ColorPickerUserControl
|
||||
{
|
||||
public struct Color
|
||||
{
|
||||
public string ColorName { get; set; }
|
||||
public SolidColorBrush ColorBrush { get; set; }
|
||||
}
|
||||
|
||||
public List<Color> Colors { get; }
|
||||
private ColorPickerControlVm Model => ComboBox.DataContext as ColorPickerControlVm;
|
||||
|
||||
public SolidColorBrush SelectedColor
|
||||
{
|
||||
@@ -34,17 +27,17 @@ namespace ModernKeePass.Views.UserControls
|
||||
public ColorPickerUserControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
Colors = new List<Color>();
|
||||
var type = typeof(Windows.UI.Colors);
|
||||
var properties = type.GetRuntimeProperties().ToArray();
|
||||
foreach (var propertyInfo in properties)
|
||||
{
|
||||
Colors.Add(new Color
|
||||
{
|
||||
ColorName = propertyInfo.Name,
|
||||
ColorBrush = new SolidColorBrush((Windows.UI.Color)propertyInfo.GetValue(null, null))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ComboBox_OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Model.Initialize(SelectedColor);
|
||||
}
|
||||
|
||||
private void ComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (e.RemovedItems.Any())
|
||||
SelectedColor = ComboBox.SelectedValue as SolidColorBrush;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user