Ind*_*ore 1 xaml microsoft-metro windows-8
我想在windows-8中使用自己的RGB值创建新颜色.
就像android中的color.xml一样.
有谁知道如何做到这一点?
我创建了一个Color.xaml资源字典,如下所示
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="MyBlack" Color="#000000"/>
</ResourceDictionary>
Run Code Online (Sandbox Code Playgroud)
然后在App.xaml我添加以下内容
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
...
...
<ResourceDictionary Source="Color.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)
在我,Text.xaml我用过这个
<TextBlock Text="How are you?" Foreground="{StaticResource MyBlack}"/>
Run Code Online (Sandbox Code Playgroud)
PS感谢Antonio Bakula的回答,请看一下.
| 归档时间: |
|
| 查看次数: |
838 次 |
| 最近记录: |