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

    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. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 03 Aug 2012 Link to this post

    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.

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

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

    Thanks again
    Chelsea
Back to Top