Problem in Change a border color when telerik:RadComboBox is empty

3 posts, 0 answers
  1. Shanka
    Shanka avatar
    17 posts
    Member since:
    Jun 2010

    Posted 06 Apr 2011 Link to this post

    I want to  apply  a style when a RadComboBox is not selected value
    I try with ComboBox its working correctly but how to apply it in to a telerik:RadComboBox
    please help.

    My Style

     <Style x:Key="requiredFieldValidationStyle">
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Text}" Value="">
                        <Setter Property="telerik:RadComboBox.BorderBrush" Value="Red" />
                        <Setter Property="telerik:RadComboBox.BorderThickness" Value="2" />


      <ComboBox Style="{StaticResource requiredFieldValidationStyle}" Margin="12,99,24.442,0" Height="24" VerticalAlignment="Top">
                <ComboBoxItem />
                <ComboBoxItem> </ComboBoxItem>

       <telerik:RadComboBox Style="{StaticResource requiredFieldValidationStyle}" telerik:Theming.Theme="Vista" Height="53.169" Margin="24.442,12,12,0" Width="219.558" VerticalAlignment="Top">
                <telerik:RadComboBoxItem Content=""/>
                <telerik:RadComboBoxItem Content="Item 1"/>
                <telerik:RadComboBoxItem Content="Item 2"/>

    Thank you
  2. Shanka
    Shanka avatar
    17 posts
    Member since:
    Jun 2010

    Posted 06 Apr 2011 Link to this post


    Color is applied but mouse over its change to a default color as orange.
     Can I stop change to default color in radcombobox

    thank you
  3. Dani
    Dani avatar
    848 posts

    Posted 11 Apr 2011 Link to this post

    Hi Shanka,

    If you generate the template of RadComboBox in Blend and examine the template structure, you will notice that there are a few Borders inside. Only one of them however is template-bound to the BorderBrush value. So what happens is that when your DataTrigger gets triggered and the red border appears, the focus border (and consequently the mouse over border) appears on top of it.

    I suggest that you take the approach demonstrated in the attached sample - add one more border in the template structure after all original borders. It  will serve the purpose of signalling when the data triggers is executed. Search for "NOTE" in the attached sample to localize the key spots.

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top