This is a migrated thread and some comments may be shown as answers.

How to change the focus border color

5 Answers 1258 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Vikas
Top achievements
Rank 1
Vikas asked on 09 Jan 2015, 05:13 PM
How can i change the border color of combobox when it has keyboard focus, I am trying to change this in combo box style but it has no effect

<Border x:Name="FocusVisual" BorderBrush="#FFFFC92B" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" CornerRadius="1" IsHitTestVisible="False" Visibility="Collapsed">
<Border BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0"/>
</Border>

Also is there any example that shows how to change several other colors, like background of combo box button chrome, color on mouse over, color when drop down is open, mouse over for items
Are there static brushes for any of these or i have create whole new style

I am using implicit styles

thanks
Vikas

5 Answers, 1 is accepted

Sort by
0
Vikas
Top achievements
Rank 1
answered on 09 Jan 2015, 09:04 PM
I am not able to understand why creating custom style is so different for implicit styles using no binaries XAML and not using implicit styles.
Without implicit styles i am able to get to all the visuals in expression blend (PressedVisual) basically i can create a copy of buttonchrome
But i am not able to do the same using implicit styles
0
Nasko
Telerik team
answered on 12 Jan 2015, 01:36 PM
Hi Vikas,

  1. Implicit Styles give the ability to create a custom style that is based on the default one of the control and modify it as needed (no need to extract all the used StaticResources). Please, check the following article from our help documentation that provides more detailed information:
    http://docs.telerik.com/devtools/wpf/styling-and-appearance/styling-apperance-implicit-styles-overview.html
  2. In order to achieve the desired appearance of RadComboBox the BorderBrush property of the "FocusVisual" border of the ButtonChrome needs to be modified as needed.
We have created a sample project that demonstrates the described approach - please, check it.

Hopes this helps.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Vikas
Top achievements
Rank 1
answered on 12 Jan 2015, 07:22 PM
Thanks. I am creating a new style and giving it a key
<Style x:Key="RadComboBoxStyle1" TargetType="{x:Type telerik:RadComboBox}">

I also need to change the mouse over highlight color of the Radcomboboxitems on mouseover, I am able to do this for WPF combobox using this but it does not work for Radcombobox
<Style.Resources>
                            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Red"/>
                        </Style.Resources>
0
Vikas
Top achievements
Rank 1
answered on 12 Jan 2015, 07:29 PM
I got it, but i had to create a new style of itemcontainer style and i just changed one thing in there HighlightVsual. Is there a better way to do this.
<Style x:Key="RadComboBoxItemStyle1" TargetType="{x:Type telerik:RadComboBoxItem}">
<Border x:Name="HighlightVisual" 
0
Nasko
Telerik team
answered on 13 Jan 2015, 12:34 PM
Hi Vikas,

I am glad you've managed to achieve the desired appearance. As, for the approach you used it is the most appropriate one - by creating new ItemContainerStyle (this style is set in order to modify the default style of the items)  and modifying the "HighlightVisual" border's Background property.

Hopes this helps.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ComboBox
Asked by
Vikas
Top achievements
Rank 1
Answers by
Vikas
Top achievements
Rank 1
Nasko
Telerik team
Share this question
or