You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to create a brush that has different colors in light theme vs dark theme? I know MDIX does this internally but how can I add a brush to the light and dark theme?
Would it be something like this when I am changing themes or is there a better way to do this?
// Remove the existing custom theme dictionary
var existingCustomDictionary = Application.Current.Resources.MergedDictionaries
.FirstOrDefault(d => d.Source != null &&
(d.Source.ToString().Contains("CustomLightTheme.xaml") ||
d.Source.ToString().Contains("CustomDarkTheme.xaml")));
if (existingCustomDictionary != null)
{
Application.Current.Resources.MergedDictionaries.Remove(existingCustomDictionary);
}
// Add the new custom theme dictionary
var newCustomDictionary = new ResourceDictionary() { Source = new Uri(customThemeResourcePath, UriKind.RelativeOrAbsolute) };
Application.Current.Resources.MergedDictionaries.Add(newCustomDictionary);
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Is there a way to create a brush that has different colors in light theme vs dark theme? I know MDIX does this internally but how can I add a brush to the light and dark theme?
Would it be something like this when I am changing themes or is there a better way to do this?
Beta Was this translation helpful? Give feedback.
All reactions