File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,7 @@ public async Task<bool> TryLoadThemeAsync(AppTheme theme)
97
97
{
98
98
Themes . Add ( theme ) ;
99
99
}
100
+ ForceReloadResourceFile ( ) ;
100
101
return true ;
101
102
}
102
103
return false ;
@@ -108,6 +109,22 @@ public async Task<bool> TryLoadThemeAsync(AppTheme theme)
108
109
}
109
110
}
110
111
112
+ /// <summary>
113
+ /// Forces the application to use the correct resource styles
114
+ /// </summary>
115
+ private void ForceReloadResourceFile ( )
116
+ {
117
+ // Get the index of the current theme
118
+ var selTheme = ThemeHelper . RootTheme ;
119
+
120
+ // Toggle between the themes to force the controls to use the new resource styles
121
+ ThemeHelper . RootTheme = ElementTheme . Dark ;
122
+ ThemeHelper . RootTheme = ElementTheme . Light ;
123
+
124
+ // Restore the theme to the correct theme
125
+ ThemeHelper . RootTheme = selTheme ;
126
+ }
127
+
111
128
public async Task < ResourceDictionary > TryLoadResourceDictionary ( AppTheme theme )
112
129
{
113
130
StorageFile file ;
You can’t perform that action at this time.
0 commit comments