public DateTime? ToDate { get; set; }
status is ToDate
, I added a property to model. logic looks like:
public SolidColorBrush ToDateForeground
{
get
{
if (ToDate.HasValue && ToDate.Value <= DateTime.Now)
{
return new SolidColorBrush(Colors.Red);
}
return Application.Current.Resources["SystemControlForegroundBaseLowBrush"];
}
}
Xaml
<TextBlock Foreground="{x:Bind ToDateForeground, Mode=OneWay}" Text="Test" />
It can work, however, if the user changes the Windows color to Dark, the ToDateForeground
doesn't automatically change.
How to deal with it, just like ThemeReource
?