Foreground of column header is always black and cannot be changed

3 posts, 0 answers
  1. Cheng
    Cheng avatar
    2 posts
    Member since:
    Mar 2011

    Posted 02 Aug 2012 Link to this post


    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" />

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

    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?

  2. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 03 Aug 2012 Link to this post


     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.

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Cheng
    Cheng avatar
    2 posts
    Member since:
    Mar 2011

    Posted 06 Aug 2012 Link to this post

    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"/>

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

    Thanks again
Back to Top