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

RadComboboxItem foreground

4 Answers 124 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 24 Feb 2010, 08:30 PM
Hi,
I have been struggling with the foreground property since yesterday.

I'm trying to restyle the Combobox to be similar to the ExpressionDark toolkit.
However, when it come to the ComboboxItem, I can't set the foreground property.

I've tried <Setter Property="Foreground" Value="White"/> in different location within the XAML but I'm always stuck with the black foreground.

Am I missing something (bug maybe) or I just do something wrong??

4 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 24 Feb 2010, 09:04 PM
Finally found it. I had to create a Style just for the foreground property and apply it to my contentcontrol.  I dunno why i didn't figure it since yesterday.


<Style x:Key="WhiteForeground" TargetType="ContentControl">
            <Setter Property="Foreground" Value="White"/>
</Style>
       

        <Style x:Key="ComboBoxItem_HighlightChromeStyle" TargetType="Telerik_Windows_Controls_Chromes:ButtonChrome">
            <Setter Property="IsTabStop" Value="False"/>
            <Setter Property="Template" Value="{StaticResource ComboBoxItem_HighlightChromeTemplate}"/>
        </Style>
        <Style x:Key="RadComboBoxItemStyle1" TargetType="telerikInput:RadComboBoxItem">
            <Setter Property="MinHeight" Value="16"/>
            <Setter Property="Margin" Value="0 0 0 1"/>
            <Setter Property="Padding" Value="3 0"/>
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="telerikInput:RadComboBoxItem">
                        <Grid Background="Transparent">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonChrome" Storyboard.TargetProperty="RenderMouseOver">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <System:Boolean>True</System:Boolean>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Opacity">
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0.33"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Telerik_Windows_Controls_Chromes:ButtonChrome x:Name="ButtonChrome" Style="{StaticResource ComboBoxItem_HighlightChromeStyle}" RenderEnabled="{TemplateBinding IsEnabled}"/>
                            <ContentControl x:Name="Content" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Padding="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Style="{StaticResource WhiteForeground}"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
0
Konstantina
Telerik team
answered on 02 Mar 2010, 09:35 AM
Hello Mike,

Thank you for contacting us.

We are glad that you have figure it out yourself.
Currently we are working on the proper application of the Foreground property of the ComboBoxItem, i.e. after the official release you will be able to set the Foreground property of each Item and it will work as expected.

If you have any other questions please feel free to contact us again.

All the best,
Konstantina
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.
0
Toby Riley
Top achievements
Rank 1
answered on 19 Mar 2010, 05:34 PM
Hi,

I have upgraded from Q3 09 to Q1 10 and face a very frustrating issue with the foreground of my combobox. 
Before it was a black background and a white foreground (In the dropdown and on selection). 
Now after the upgrade all the items in the dropdown have a foreground of white but when I select one and the dropdown closes the selected item is show in back text (foreground).

Can you help please?
0
Konstantina
Telerik team
answered on 24 Mar 2010, 01:02 PM
Hello Tobias,

Thank you for contacting us.

Could you please send us a code snippet of the xaml code of your ComboBox? Also, could you explain what exactly you expect to be the behaviour of the Foreground property of the ComboBox? In that way we will be able to assist you in the best manner.

Looking forward to your reply.

All the best,
Konstantina
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
Mike
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Konstantina
Telerik team
Toby Riley
Top achievements
Rank 1
Share this question
or