I am trying to add Dark Theme support to my hobby app. App is WinForms, and I do not want to rewrite UI in WPF. So, instead I am trying to add couple of WPF controls into my app, mainly because they allow theming of a Scrollbar.
I am following this tutorial to host control: https://www.codeproject.com/Articles/739902/How-to-Easily-Host-WPF-Control-inside-Windows-Form
Everything works so far, except that I can't change Background color for my WPF control hosted in WinForms dynamically. I tried many things, raising property changed, calling SetValue etc, but the only way I could control Background/Foreground is by directly setting them in XAML, which is not what I want, because I want to be able to change color optionally.
Here's what I imagine is the closest to what I want:
System.Windows.Style style = new System.Windows.Style();
style.TargetType = typeof(WpfControls.ListViewControl);
style.Setters.Add(new System.Windows.Setter(WpfControls.ListViewControl.BackgroundProperty, System.Windows.Media.Brushes.Pink));
style.Setters.Add(new System.Windows.Setter(WpfControls.ListViewControl.ForegroundProperty, System.Windows.Media.Brushes.Red));
this.listViewControl.Style = style;
Color does not change. The code is here: https://github.com/TheIronWolfModding/WpfControlsWinFormsHost/blob/master/WindowsFormsHost_Test/Form1.cs