mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-04 08:00:16 -04:00
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:
28
ModernKeePass/Common/NotifyPropertyChangedBase.cs
Normal file
28
ModernKeePass/Common/NotifyPropertyChangedBase.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace ModernKeePass.Common
|
||||
{
|
||||
public class NotifyPropertyChangedBase : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
protected bool SetProperty<T>(ref T property, T value, [CallerMemberName] string propertyName = "")
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(property, value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
property = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@@ -46,6 +46,14 @@ namespace ModernKeePass.Common
|
||||
this.Add(item.Key, item.Value);
|
||||
}
|
||||
|
||||
public void AddRange(IEnumerable<KeyValuePair<string, object>> values)
|
||||
{
|
||||
foreach (var value in values)
|
||||
{
|
||||
Add(value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Remove(string key)
|
||||
{
|
||||
if (this._dictionary.Remove(key))
|
||||
|
Reference in New Issue
Block a user