added theme mode to view and object accessor for setting properties

This commit is contained in:
2020-04-09 21:57:49 +02:00
parent 365537102f
commit 59fe84a53f
6 changed files with 50 additions and 20 deletions

View File

@ -1,13 +1,20 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using FastMember;
using Prism.Mvvm;
namespace ModernWpfPlayground.MvvmStuff
{
public abstract class BaseViewModel : BindableBase
{
protected BaseViewModel()
{
ObjectAccessor = ObjectAccessor.Create(this);
}
private readonly Dictionary<string, object> _values = new Dictionary<string, object>();
protected readonly ObjectAccessor ObjectAccessor;
protected IReadOnlyDictionary<string, object> Values => _values;
@ -44,8 +51,7 @@ namespace ModernWpfPlayground.MvvmStuff
{
foreach (var (key, value) in GetViewModelItems())
{
_values[key] = value!;
RaisePropertyChanged(key);
ObjectAccessor[key] = value;
}
}
}