2
votes

WPF application look and feel is different in Win7 & Win10 versions as shown in the attached figure. All the controls have red border but in Win10 the following behavior is noticed. Textboxes (on hover and selection) and comboboxes border changes to blue color in Win 10.

The applied style is as follows

<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>

The red border is applied thru code behind as follows when the above behavior is noticed

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 How can I get the same look and feel across all the OS versions of Windows?

1
Try to add the aero dll and embedd it to your app.xaml. This will change a lot ^^Felix D.
Will add the same and revert back with the findingsRohanDsouza

1 Answers

1
votes

The following solution worked in my case. Thanks to Fe De for pointing me in the right direction. 1. Add the following to App.xaml file 2. Override the controls base styles as follows:

<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}}">