2012-11-25 36 views
1

我正在構建Metro應用程序。我已將背景顏色設置爲黑色,並將前景設置爲白色。當我構建並測試並翻轉按鈕時,它將其顏色更改爲白色。這不適用於我的配色方案。Windows 8 Metro按鈕顏色在滾動時發生更改

如何防止按鈕在翻滾時改變顏色?

感謝

+0

通過運氣發現它。必須爲按鈕添加新的樣式。 – james

回答

2

你想通了,你需要一個按鈕(或按鈕在你的應用程序的一個子集)做什麼。但是,如果您想爲應用中的所有按鈕執行此操作,則可以在app.xaml中覆蓋:

<ResourceDictionary.ThemeDictionaries> 
     <!-- When not in high contrast mode, use a colorful look. 
           Note that this is defining an implicit style that is scoped to this StackPanel. --> 

     <ResourceDictionary x:Key="Default"> 
      <Thickness x:Key="ButtonBorderThemeThickness">2</Thickness> 
      <SolidColorBrush x:Key="ButtonForegroundThemeBrush" Color="#FFFFFFFF" /> 
      <SolidColorBrush x:Key="ButtonBackgroundThemeBrush" Color="#FF0088B4" /> 
      <SolidColorBrush x:Key="ButtonPointerOverForegroundThemeBrush" Color="#FF0088B4" /> 
      <SolidColorBrush x:Key="ButtonPointerOverBackgroundThemeBrush" Color="#FF7ED1EC" /> 
      <SolidColorBrush x:Key="ButtonPressedForegroundThemeBrush" Color="#FF0088B4" /> 
      <SolidColorBrush x:Key="ButtonPressedBackgroundThemeBrush" Color="#FFFFFFFF" /> 
      <SolidColorBrush x:Key="ButtonBorderThemeBrush" Color="#FF0088B4" /> 
      </ResourceDictionary> 
     </ResourceDictionary.ThemeDictionaries> 
+0

非常感謝幫助。 – james