yam*_*pog 2 styles windows-8 windows-runtime
我正在尝试为我的页面中的控件定义标准前景色.但是,我得到错误"类型的对象"System.String"不能应用于期望类型"Windows.UI.Xaml.Media.Brush"的属性.
在myPage.xaml中
<TextBlock TextWrapping="Wrap"
Foreground="{StaticResource ForegroundThemeBrush}" />
Run Code Online (Sandbox Code Playgroud)
在StandardStyles.xaml中
<ResourceDictionary x:Key="Default">
<x:String x:Key="BackgroundThemeBrush">#484848</x:String>
<x:String x:Key="ForegroundThemeBrush">#efefef</x:String>
</ResourceDictionary>
Run Code Online (Sandbox Code Playgroud)
你需要定义SolidColorBrush不x:String
<ResourceDictionary x:Key="Default">
<SolidColorBrush x:Key="BackgroundThemeBrush" Color="#484848"/>
<SolidColorBrush x:Key="ForegroundThemeBrush" Color="#efefef"/>
</ResourceDictionary>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
470 次 |
| 最近记录: |