mirror of
https://github.com/holgerb83/ModernWpfPlayground.git
synced 2025-06-30 09:40:52 +02:00
added theme mode to view and object accessor for setting properties
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user