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

Foreground of column header is always black and cannot be changed

2 Answers 59 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Cheng
Top achievements
Rank 1
Cheng asked on 02 Aug 2012, 10:09 AM
Hi,

The version of telerik I'm using is 2010.2.609.1040. I use the RadGridView control in my silverlight xaml file, and the foregound of the column header is white on design time, however, it is very strange that the foregound of it turns to Black on run time. So, I use GridViewHeaderCellStyle in GridViewDataColumn to set the foregound to white, but it still cannot work.

My code as below:

<Style x:Key="MyHeaderCellStyle" TargetType="telerik:GridViewHeaderCell">
            <Setter Property="Foreground" Value="White" />
 </Style>

<telerik:RadGridView x:Name="VirtualMachineListGrid" Grid.Row="1" ShowGroupPanel="False" CanUserInsertRows="False"
               CanUserDeleteRows="False" AutoGenerateColumns="False"        
                                 ItemsSource="{Binding}">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Name" HeaderTextAlignment="Center" IsAutoGenerated="False" Width="120"
                                                IsReadOnly="True" DataMemberBinding="{Binding AliasName}" HeaderCellStyle="{StaticResource MyHeaderCellStyle}"/>
 
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

Even if I change the foregound color to others, it still shows black.
I use PRISM in my souce code framework. I'm not sure whether it is related to PRISM, since all are OK if I create a new silverlight application without using PRISM.

Can you help me?

Thanks
Chelsea

2 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 03 Aug 2012, 11:16 AM
Hi,

 You say that the version of Telerik you are using is 2010.2.609.1040. This is a Beta version. Please check this forum thread where you can find a sample project (using binaries from Q2 2010) attached.

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Cheng
Top achievements
Rank 1
answered on 06 Aug 2012, 09:35 AM
Hi Didie,

Thank you for your response. I have known where the wrong is.

I have set the TextBlock style in my Style.xaml file like the code below:

<Style TargetType="TextBlock">
        <Setter Property="Foreground" Value="{StaticResource TextBrush}"/>
        <Setter Property="FontFamily" Value="Segoe UI, Lucida Sans Unicode, Verdana"/>
        <Setter Property="FontSize" Value="11"/>
</Style>

I don't set the "x:Key" property, so the style will apply to all controls which reference the TextBlock.

Thanks again
Chelsea
Tags
GridView
Asked by
Cheng
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Cheng
Top achievements
Rank 1
Share this question
or