Search code examples
wpfwindows-8

Border color of combox does not change - Windows 8


The border does not change. I don't have a global/local style applied, only one for fontSize.
App.xaml is empty..no styles there.

If have also added a combobox to a plain window and set the border color, also with no luck???

So where could it be overriden?

The combobox sits in window root, it has no container like Grid,StackPanel,etc.

The window:

<Window x:Name="XyzWindow" x:Class="Xyz.Final" Title="MyTitle"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:wc="clr-namespace:System.Windows.Controls;assembly=PresentationFramework"
        xmlns:local="clr-namespace:Hasng"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        d:DataContext="{d:DesignInstance local:MainWindowViewModel,IsDesignTimeCreatable=True}" 
        mc:Ignorable="d" Height="350" Width="650" ResizeMode="NoResize" AutomationProperties.Name="wHashScreen" 
        Icon="/xyz;component/IMG/thumbprint.png" FontWeight="Bold" UseLayoutRounding="False" WindowStartupLocation="CenterScreen" WindowStyle="ThreeDBorderWindow">

enter image description here


Solution

  • To enable the ComboBox' BorderBrush property you'll need to edit the Template and change the Binding in the ToggleButton ControlTemplate

    BorderBrush="{StaticResource ComboBox.Static.Border}"
    

    to

    BorderBrush="{TemplateBinding BorderBrush}"