Suppose in my WPF program, I have created an option for the user to change the application theme (dark and light). What if I want to change all of the icons based on the selected theme? What's the best approach to do this?
Use a dynamic resource for your image source like this:
<Image Source="{DynamicResource MyImageSource}" />
Then you can update the resource when the theme changes with this code:
Application.Current.Resources["MyImageSource"] = new BitmapImage(new Uri($"pack://application:,,,/Resources/{themeName}.png"));