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

Foreground Combobox is not effect

5 Answers 90 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Son
Top achievements
Rank 1
Son asked on 20 Sep 2011, 12:48 PM
I have tried to set foreground to another color but it is always black. How can I set foreground ? Please help me
<telerik:RadComboBox Foreground="Red" x:Name="PeriodComboBox" />

5 Answers, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 22 Sep 2011, 12:52 PM
Hi Son,

The Foreground property will work only in an editable RadComboBox. In order to change the color of the text in non editable RadComboBox you need to set SelectionBoxItemTemplate. You can check this example for more info.

Greetings,
Boyan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Son
Top achievements
Rank 1
answered on 23 Sep 2011, 07:33 AM
<DataTemplate x:Key="ComboBoxSimpleTemplate">
    <Grid>
        <TextBlock Foreground="Red" Text="{Binding Name}" />
    </Grid>
</DataTemplate>
I tried to use SelectionBoxTemplate="{StaticResource ComboBoxSimpleTemplate}". it works fine but the problem is that I have many comboboxes with different itemsource like City, Country, Gender, Job, so on. ...
If I use DataTemplate then I have to create one DataTemplate for each combobox. Because Text="{Binding Name}" depends on displayfield of that combobox.
Ex. <TextBlock Foreground="Red" Text="{Binding City}" />
<TextBlock Foreground="Red" Text="{Binding Gender}" />
<TextBlock Foreground="Red" Text="{Binding JobName}" />
0
Boyan
Telerik team
answered on 29 Sep 2011, 08:32 AM
Hi Son,

You can achieve this by editing the template of the RadCombobox and then find NonEditable ComboBox and then set the Foreground of 
<telerik:RadToggleButton x:Name="PART_DropDownButton" IsTabStop="False" Margin="0" Padding="0" ClickMode="Press" telerik:StyleManager.Theme="{StaticResource Theme}">

Then apply the style to all RadComboBoxes and set the binding for each of them in its XAML. I have attached the template of RadComboBox for Office_Black theme. You can get the templates of other themes from your installation. The path is this:
C:\Program Files (x86)\Telerik\RadControls for Silverlight Q2 2011 SP1\Themes

Hope this works for you. Let me know if you need further help.

All the best,
Boyan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Son
Top achievements
Rank 1
answered on 29 Sep 2011, 08:42 AM
Thank you Boyan
Can you make it clear ? How can I edit the template of the RadCombobox and change the foreground in code behind ?
Thanks
0
Konstantina
Telerik team
answered on 03 Oct 2011, 02:29 PM
Hello Son,

This issue will be fixed with the internal build next week. You will be able to set the foreground of a non editable ComboBox through the Foreground property.
Sorry for the caused inconvenience.

Best wishes,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
ComboBox
Asked by
Son
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Son
Top achievements
Rank 1
Konstantina
Telerik team
Share this question
or