mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Icons work again
Colors work again
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using ModernKeePass.Extensions;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Media;
|
||||
@@ -9,19 +10,15 @@ namespace ModernKeePass.Converters
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
var color = value is Color ? (Color?) value : Color.Empty;
|
||||
var color = value as Color? ?? Color.Empty;
|
||||
if (color == Color.Empty && parameter is SolidColorBrush) return (SolidColorBrush) parameter;
|
||||
return new SolidColorBrush(Windows.UI.Color.FromArgb(
|
||||
color.Value.A,
|
||||
color.Value.R,
|
||||
color.Value.G,
|
||||
color.Value.B));
|
||||
return color.ToSolidColorBrush();
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
var brush = value as SolidColorBrush;
|
||||
return brush == null ? new Color() : Color.FromArgb(brush.Color.A, brush.Color.R, brush.Color.G, brush.Color.B);
|
||||
return brush?.ToColor() ?? new Color();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user