Question

I am using the Xceed data grid control and I am trying to change the header colors, but seem to be having some trouble. What I have right now is the following code snippet:

Style style = new Style(typeof(ColumnManagerRow));
style.Setters.Add(new Setter(ColumnManagerRow.BackgroundProperty, Brushes.Black));
this.grid.Resources[typeof(ColumnManagerRow)] = style;

This works for the most part, but I am still seeing some gray around it. Any help would be greatly appreciated.

EDIT

I've added an image with the selected areas that I'd like to have as the same color. enter image description here

Was it helpful?

Solution

You could do this in XAML:

<ControlTemplate x:Key="HeaderTemplate" TargetType="{x:Type xcdg:ColumnManagerCell}">
    <TextBlock Text="{TemplateBinding Content}">
        <TextBlock.Style>
            <Style TargetType="{x:Type TextBlock}">
                <Setter Property="Background" Value="Black" />
                <Setter Property="Foreground" Value="Red" />
            </Style>
        </TextBlock.Style>
    </TextBlock>
</ControlTemplate>

<Style TargetType="{x:Type xcdg:ColumnManagerRow}">
    <Setter Property="Background" Value="Black"/>
    <Setter Property="BorderBrush" Value="Black"/>
</Style>                

<Style TargetType="{x:Type xcdg:ColumnManagerCell}">
    <Setter Property="Template" Value="{StaticResource HeaderTemplate}"/>
</Style>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top