ComboBox styles and templates

4 posts, 1 answers
  1. Sergiy
    Sergiy avatar
    38 posts
    Member since:
    Jan 2012

    Posted 14 Nov 2012 Link to this post

    Hello, I want to change Combobox style ( for instance simple changes of borderbrush, see attached file please).
    I tried to change some value of colors in templates, but there is no any result.

    Could you explain me step-by-step how can I change borderbrush (of cause separate color when control is enabled and disabled)?
    Thank You
  2. Answer
    Masha
    Admin
    Masha avatar
    355 posts

    Posted 19 Nov 2012 Link to this post

    Hello Sergiy,

    To change the BorderBrush and MouseOver color of RadComboBox, you need to modify the style applied on RadToggleButton(x:Name=PART_DropDownButton). Inside it you can define the BorderBrush you wish to apply on your RadComboBox. In the attached project it is
    <Style x:Key="CustomNonEditableComboToggleButtonStyle" TargetType="telerik:RadToggleButton" BasedOn="{StaticResource NonEditableComboToggleButtonStyle}">
        <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
        <Setter Property="Template" Value="{StaticResource CustomNonEditableComboToggleButtonControlTemplate}" />
    </Style>

    CustomNonEditableComboToggleButtonControlTemplate is responsible for rendering mouse over brushes, pressed and selection brushes. Inside it search for
    <Border x:Name="ToggleButtonBackgroundChecked" Grid.ColumnSpan="2" Background="{StaticResource AccentBrush}" Visibility="Collapsed" />

    and modify the background color with the color of your choice. 

    If you wish to make modification on BorderBrush in Focus state you should modify the Border with name x:Name="FocusVisual" as well.

    Please, find attached an illustrative sample, using Implicit Styles.
    Hope it helps.

    All the best,
    Maria
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. miki
    miki avatar
    37 posts
    Member since:
    Dec 2014

    Posted 30 Dec 2014 Link to this post

    i found this thread because i search for something like this.
    So i tool the example solution and add another ComboBox but the new one is with the default style, how can i change this style like the first one ?
  5. Nasko
    Admin
    Nasko avatar
    586 posts

    Posted 05 Jan 2015 Link to this post

    Hello Sergui,

    The provided sample project uses Implicit Styles in order to modify the style of RadComboBox - thus the style should be applied implicitly to all RadComboBoxes inside the project, so everything should work as expected. Please, check the following article from our help documentation that provides more detailed information about the Implicit Styles:
    http://docs.telerik.com/devtools/wpf/styling-and-appearance/styling-apperance-implicit-styles-overview.html

    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