Processing
 

Border color of combox does not change - Windows 8

13/08/2016 17:26#1

Legends

Member

Joined at: 4 months ago

Post: 4

Thank: 0

Thanked: 0

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

Border color of combox does not change - Windows 8

13/08/2016 21:04Top#2

Funk

Member

Joined at: 10 months ago

Post: 2

Thank: 0

Thanked: 0

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}" 
13/08/2016 18:21Top#3

Rennie

Member

Joined at: 4 months ago

Post: 1

Thank: 0

Thanked: 0

I had similar issues while loading my application on Windows 8, which used to work fine on Windows 10 and Windows 7.

This is a workaround I have done for such applications which needed to be run on Win8. I have added a border around the control and it used to display it without any issues in Windows8. I hope this helps in your case too.

<Border Name="ComboBoxBorder" BorderThickness="1.5" BorderBrush="Red">     <ComboBox Name="ComBoxName"  Width="80" Height="45">         <ComboBoxItem>A</ComboBoxItem>         <ComboBoxItem>B</ComboBoxItem>     </ComboBox> </Border> 
13/08/2016 22:06Top#4

Legends

Member

Joined at: 4 months ago

Post: 4

Thank: 0

Thanked: 0

I think this workaround is only needed on Windows 8

In addition two Funk's answer:

1.) Put a combobox on the Ui --> right-click--> Edit template-> Edit a copy
--> Choose application --> Ok(ComboBoxStyleNew)

2.) [Copied from Funk's answer:]

Change the BorderBrush property of

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

to (this makes the borderbrush property overridable)

BorderBrush="{TemplateBinding BorderBrush}" 

here a little excerpt:

 <Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">             <Setter Property="OverridesDefaultStyle" Value="true"/>             <Setter Property="IsTabStop" Value="false"/>             <Setter Property="Focusable" Value="false"/>             <Setter Property="ClickMode" Value="Press"/>             <Setter Property="Template">                 <Setter.Value>                     <ControlTemplate TargetType="{x:Type ToggleButton}">                         <Border x:Name="templateRoot" BorderBrush="{TemplateBinding BorderBrush}" 

In my case I use MultiDataTriggers, to change the border color of the combobox dynamically. ComboBoxStyleNew is the name/key of the control template resource we created in step 1. ComboBoxTemplate is the key of the combobox template.

<ComboBox x:Name="comboBox" Template="{DynamicResource ComboBoxTemplate}"> <ComboBox.Style>     <Style TargetType="ComboBox" BasedOn="{StaticResource ComboBoxStyleNew}">         <Style.Triggers>             <MultiDataTrigger>                 <MultiDataTrigger.Conditions>                     <Condition                          Binding="{Binding Tag, ElementName=Button1MouseDetector}"                          Value="MouseOver"                          />                     <Condition                          Binding="{Binding IsEnabled, ElementName=button1}"                          Value="False"                          />                 </MultiDataTrigger.Conditions>                 <Setter Property="BorderBrush" Value="Red" />             </MultiDataTrigger>                              </Style.Triggers>     </Style> </ComboBox.Style> </ComboBox> 
Similar articles

Window Registry create key not working in java

4 months ago - Reply: 1 - Views: 74

Metro App crash on Windows 10

4 months ago - Reply: 2 - Views: 115

.dll file missing after php upgrade

5 months ago - Reply: 1 - Views: 27

Notepad++ launch multiple HTML within browser

5 months ago - Reply: 0 - Views: 2

Access 2003 freezing

5 months ago - Reply: 0 - Views: 2

Icon Handler Shell Extension not called

5 months ago - Reply: 1 - Views: 23

Border color of combox does not change - Windows 8

5 months ago - Reply: 3 - Views: 140

VB.NET error DatagridViewCellValueChanged Windows 8

6 months ago - Reply: 1 - Views: 40

I made a mistake when installing Hyper-V [on hold]

6 months ago - Reply: 0 - Views: 7

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re