How to change the focus border color

6 posts, 0 answers
  1. Vikas
    Vikas avatar
    64 posts
    Member since:
    May 2014

    Posted 09 Jan 2015 Link to this post

    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
  2. Vikas
    Vikas avatar
    64 posts
    Member since:
    May 2014

    Posted 09 Jan 2015 in reply to Vikas Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Nasko
    Admin
    Nasko avatar
    588 posts

    Posted 12 Jan 2015 Link to this post

    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.

     
  5. Vikas
    Vikas avatar
    64 posts
    Member since:
    May 2014

    Posted 12 Jan 2015 in reply to Nasko Link to this post

    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>
  6. Vikas
    Vikas avatar
    64 posts
    Member since:
    May 2014

    Posted 12 Jan 2015 in reply to Vikas Link to this post

    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" 
  7. Nasko
    Admin
    Nasko avatar
    588 posts

    Posted 13 Jan 2015 Link to this post

    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.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready