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

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

2 Answers 406 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Shanka
Top achievements
Rank 1
Shanka asked on 06 Apr 2011, 07:21 AM
Hi
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">
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Text}" Value="">
                    <Setter Property="telerik:RadComboBox.BorderBrush" Value="Red" />
                    <Setter Property="telerik:RadComboBox.BorderThickness" Value="2" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

Combobox

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

RadComboBox
   <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"/>
        </telerik:RadComboBox>



Thank you

2 Answers, 1 is accepted

Sort by
0
Shanka
Top achievements
Rank 1
answered on 06 Apr 2011, 07:56 AM
Hi,

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
0
Dani
Telerik team
answered on 11 Apr 2011, 11:43 AM
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.


Greetings,
Dani
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
Tags
ComboBox
Asked by
Shanka
Top achievements
Rank 1
Answers by
Shanka
Top achievements
Rank 1
Dani
Telerik team
Share this question
or