New color to brush converter

New boolean to visibility converter
Base class to handle property changes notifications for all View Models
Template selector to handle a different first item in listviews or gridviews
This commit is contained in:
2017-10-03 16:06:49 +02:00
committed by BONNEVILLE Geoffroy
parent 95771878fc
commit 616d922145
22 changed files with 295 additions and 127 deletions

View File

@@ -42,11 +42,10 @@ namespace ModernKeePass.ViewModels
get { return GetEntryValue(PwDefs.NotesField); }
set { SetEntryValue(PwDefs.NotesField, value); }
}
public System.Drawing.Color? BackgroundColor => _pwEntry?.BackgroundColor;
public SolidColorBrush BackgroundColor => CreateFromColor(_pwEntry?.BackgroundColor, Colors.Transparent);
public SolidColorBrush ForegroundColor => CreateFromColor(_pwEntry?.ForegroundColor, Colors.White);
public System.Drawing.Color? ForegroundColor => _pwEntry?.ForegroundColor;
public FontWeight FontWeight => _pwEntry == null ? FontWeights.Bold : FontWeights.Normal;
public Symbol IconSymbol
@@ -82,15 +81,5 @@ namespace ModernKeePass.ViewModels
{
_pwEntry?.Strings.Set(key, new ProtectedString(true, newValue));
}
private SolidColorBrush CreateFromColor(System.Drawing.Color? color, Windows.UI.Color defaultValue)
{
if (!color.HasValue || color.Value == System.Drawing.Color.Empty) return new SolidColorBrush(defaultValue);
return new SolidColorBrush(Windows.UI.Color.FromArgb(
color.Value.A,
color.Value.R,
color.Value.G,
color.Value.B));
}
}
}