Hey guys,
I have functionality to dynamically change themes via StyleManager.ApplicationTheme. Whenever the user changes themes, there is a roughly 20~30mb spike in memory usage that never seems to get garbage collected. Any idea on what would cause this?
The following code is used to dynamically change the theme:
Thanks.
I have functionality to dynamically change themes via StyleManager.ApplicationTheme. Whenever the user changes themes, there is a roughly 20~30mb spike in memory usage that never seems to get garbage collected. Any idea on what would cause this?
The following code is used to dynamically change the theme:
public Theme ThisApplicationTheme{ get { return StyleManager.ApplicationTheme; } set { StyleManager.ApplicationTheme = value; var binding = new Binding("ThisApplicationTheme") { Source = this, Mode = BindingMode.OneWay }; foreach (Window window in Application.Current.Windows) { foreach (var element in GetWindow(window).ChildrenOfType<FrameworkElement>().ToList()) { element.SetBinding(StyleManager.ThemeProperty, binding); } } Application.Current.MainWindow.SetBinding(StyleManager.ThemeProperty, binding); }}Thanks.