在资源窗口8中创建新颜色

Ind*_*ore 1 xaml microsoft-metro windows-8


我想在windows-8中使用自己的RGB值创建新颜色.
就像android中的color.xml一样.
有谁知道如何做到这一点?

Ind*_*ore 5

我创建了一个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回答,请看一下.