Regarding your first question: βThe renewal processβ is not officially documented, but I understood the following:
The call in the user interface thread resumes. Since this is a void return method, the caller will simply continue when he waits inside. If you add something to the user interface thread, it will be in the dispatcher queue and will start after the current task (resume).
So, I just did this (and it works ^^):
private async void App_Resuming(object sender, object e) { var x1 = new SolidColorBrush((Color)Application.Current.Resources["PhoneForegroundColor"]); Debug.WriteLine(x1?.Color.ToString());
Regarding the second question: You can enter "ValueProvider" in your app.xaml, which logs a resume event and simply provides a dependency property with the current color.
You still have to install this on any text block you want to use, but at least directly in XAML. This may also work for styles, but have not tried this.
Implementation example ....
Provider:
public class ColorBindingProvider : DependencyObject { public ColorBindingProvider() { App.Current.Resuming += App_Resuming; } private async void App_Resuming(object sender, object e) {
App.xaml:
<Application.Resources> <local:ColorBindingProvider x:Name="ColorBindingProvider" TextColor="{StaticResource PhoneForegroundBrush}" /> </Application.Resources>
MainPage.xaml:
<TextBlock Text="Hey ho let go" Foreground="{Binding TextColor, Source={StaticResource ColorBindingProvider}}" />
source share