访问 C 中的主题资源
来自 MyExampleFile.xaml 的片段
<TextBlock x:Name="MyTextBlock"
Text="This is a TextBlock colored from the code behind"/>
来自 MyExampleFile.xaml.cs 的片段
// We use the application's Resource dictionary to get the current Accent of your Windows 10
MyTextBlock.Color = new SolidColorBrush(Application.Current.Resources["SystemAccentColor"]);