Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Night Vision Mode on WPF Windows

Tags:

c#

wpf

vision

We've made a WPF application with a traditional UI (common controls like tabs, buttons, labels, textboxes, and so on).

We need to add a "night vision" mode, which would make it look like Stellarium's night vision mode, so that it can be comfortably used in places with few or just no light at all.

As far as I've seen, we only have two options:

  1. A technique called "shading" (I don't know how this could be implemented in WPF).
  2. The brute-force way: defining control's style templates. As you know, this would imply a tremendous work, since we need to redefine every single property for each control being used (borders, background, brushes, etc, etc, etc).

The questions are:

  1. What's the best way to achieve this in WPF?
  2. Would it be more complicated if we work with MahApps Metro Style? I know MahApps lets you customize their style, but the problem then would be switching between to different templates (the two used for day and night vision, respectively).

Thank you very much!

like image 955
Daniel Avatar asked Mar 14 '23 14:03

Daniel


1 Answers

One suggestion is of course MahappsThemes. You could switch between Light and Dark by this :

// get the theme from the current application
var theme = ThemeManager.DetectAppStyle(Application.Current);

// now set the Green accent and dark theme
ThemeManager.ChangeAppStyle(Application.Current,
                            ThemeManager.GetAccent("Green"),
                            ThemeManager.GetAppTheme("BaseDark"));

( Mahapps.Styles for ref )

Or you could use DynamicResource for each Brushes and change the SINGLE ResourceDictionary holding them to change everything in a click :)

like image 102
fahimalizain Avatar answered Mar 29 '23 16:03

fahimalizain