Corrected issue in color picker user control when changing history

Use of commands instead of events in code-behind
Some refactoring
This commit is contained in:
Geoffroy BONNEVILLE
2020-06-04 16:29:26 +02:00
parent 5c1dfa1b0e
commit 1f04f941c2
7 changed files with 109 additions and 122 deletions

View File

@@ -1,4 +1,5 @@
using Windows.UI.Xaml;
using System.Linq;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using ModernKeePass.ViewModels;
@@ -33,7 +34,8 @@ namespace ModernKeePass.Views.UserControls
private void ComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
SelectedColor = (e.AddedItems[0] as ColorPickerControlVm.Color)?.ColorBrush;
if (e.AddedItems.Any())
SelectedColor = (e.AddedItems[0] as ColorPickerControlVm.Color)?.ColorBrush;
}
}
}