Fix theming for plugins
This commit is contained in:
@@ -3,9 +3,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Torch.API;
|
||||
using Torch.API.Plugins;
|
||||
using Torch.Server.Views;
|
||||
|
||||
namespace Torch.Server.ViewModels
|
||||
{
|
||||
@@ -23,6 +25,15 @@ namespace Torch.Server.ViewModels
|
||||
Control = p.GetControl();
|
||||
|
||||
Name = $"{plugin.Name} ({plugin.Version})";
|
||||
|
||||
ThemeControl.UpdateDynamicControls += UpdateResourceDict;
|
||||
UpdateResourceDict(ThemeControl.currentTheme);
|
||||
}
|
||||
|
||||
public void UpdateResourceDict(ResourceDictionary dictionary)
|
||||
{
|
||||
this.Control.Resources.MergedDictionaries.Clear();
|
||||
this.Control.Resources.MergedDictionaries.Add(dictionary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user