Windows phone 7 在WP7中创建自定义应用程序主题时出现问题

Windows phone 7 在WP7中创建自定义应用程序主题时出现问题,windows-phone-7,Windows Phone 7,我正在尝试在Windows Phone 7中创建自定义应用程序主题,但不幸的是遇到了以下问题:如果我尝试更改样式和某些默认颜色,结果样式应用正确,但由于某些原因颜色不正确。我的意思是我的新样式使用默认颜色而不是自定义颜色。 以下是我正在做的: 1.我创建了一个名为CustomTheme的文件夹,其中包含两个ResourceDictionary: 1.xaml style.xaml 2.接下来,我用以下方式将它们添加到App.xaml中: <Application.Resources>

我正在尝试在Windows Phone 7中创建自定义应用程序主题,但不幸的是遇到了以下问题:如果我尝试更改样式和某些默认颜色,结果样式应用正确,但由于某些原因颜色不正确。我的意思是我的新样式使用默认颜色而不是自定义颜色。

以下是我正在做的:

1.我创建了一个名为CustomTheme的文件夹,其中包含两个ResourceDictionary:

1.xaml

style.xaml

2.接下来,我用以下方式将它们添加到App.xaml中:

<Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="CustomTheme/Brushes.xaml"/>
                <ResourceDictionary Source="CustomTheme/Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
    </Application.Resources>
<TextBox Style="{StaticResource SomeStyle}"/>

三,。之后,我尝试以以下方式使用Styles.xaml中的示例样式:

<Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="CustomTheme/Brushes.xaml"/>
                <ResourceDictionary Source="CustomTheme/Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
    </Application.Resources>
<TextBox Style="{StaticResource SomeStyle}"/>

4.因此,样式按预期应用(我的意思是更改了ControlTemplate),但使用默认颜色,而不是笔刷中指定的颜色。xaml

我通过在我的Styles.xaml文件中而不是在App.xaml中添加brush.xaml,找到了解决问题的方法:

<ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Brushes.xaml"/>
    </ResourceDictionary.MergedDictionaries>


我在征求一个建议。有更好的办法解决这个问题吗?为什么颜色没有正确合并?

我所知道的解决方案是最好的,也是我们在实现RunKeeper时使用的解决方案,尽管我们也在App.xaml中保留了与您的笔刷.xaml等效的颜色

老实说,我觉得自己“崩溃了”,但至少有一个可行的解决办法:)