2015-12-02 34 views
1

WPF應用程序的外觀和感覺在Win7中是不同的& Win10版本如附圖所示。所有的控件都有紅色邊框,但在Win10中會注意到以下行爲。在Win文本框(上懸停和選擇)和組合框邊框變爲藍色10.Win7和Win10在WPF應用程序中的區別

所施加的樣式如下

<Style TargetType="{x:Type TextBox}"> 
     <Setter Property="BorderBrush" Value="#FFcecece" /> 
     <Setter Property="Foreground" Value="#FF777777"/> 
     <Setter Property="BorderThickness" Value="1.6" /> 
</Style> 

<Style TargetType="{x:Type ComboBox}"> 
     <Setter Property="BorderBrush" Value="#FFcecece" /> 
     <Setter Property="Foreground" Value="#FF777777"/> 
     <Setter Property="BorderThickness" Value="1.6" /> 
</Style> 

紅色邊界施加直通代碼後面如下當上述行爲是注意到了

textBox1.BorderBrush = Media.Brushes.Red; 
textBox3.BorderBrush = Media.Brushes.Red; 
combobox5.BorderBrush = Media.Brushes.Red; 
combobox7.BorderBrush = Media.Brushes.Red; 

Win 7 & Win 10 images 我怎樣才能獲得相同的外觀和跨Windows的所有操作系統版本有什麼感覺?

+2

嘗試添加航空DLL和它使嵌入到你的App.xaml。這將改變很多^^ –

+0

將增加相同的結果並回復 – Alice

回答

1

以下解決方案適用於我的案例。感謝Fe De爲我指出了正確的方向。 1.下面添加到App.xaml文件 2.覆蓋控件的基本樣式,如下所示:

<ResourceDictionary Source="/PresentationFramework.Aero,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSIL;component/themes/Aero.NormalColor.xaml" /> 
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">  
<Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}"> 
+0

不客氣:P –

相關問題