You could just create a light and a dark WPF Theme and then switch between them dependant on the colour currently set as the background
colour. Using this method, WPF will take care of all of the icon updates.
If you want to create your own system, you can use the DependencyProperty
system to help you:
Background
colour is changed:
You can simply add a PropertyChangedCallback
handler to the current Background
property:
static YourControl()
{
Control.BackgroundProperty.OverrideMetadata(typeof(YourControl),
new PropertyMetadata(Brushes.White, OnBackgroundChanged));
}
private static void OnBackgroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
// The Background property value changed
}
Exposing Icons and notifying the UI:
You can create a class that holds a string
property to data bind to each Image.Source
property in the following format:
"\ApplicationName;component/ImageFolderName/ImageName.FileExtension"
As long as this class implements the INotifyPropertyChanged
interface, then all you need to do is to change these string
values and the UI will automatically update with the new icons or images.