我正在使用Xceed数据网格控件,我正在尝试更改标题颜色,但似乎遇到了一些麻烦。我现在所拥有的是以下代码段:
Style style = new Style(typeof(ColumnManagerRow));
style.Setters.Add(new Setter(ColumnManagerRow.BackgroundProperty, Brushes.Black));
this.grid.Resources[typeof(ColumnManagerRow)] = style;
这在很大程度上起作用,但我仍然看到它周围有些灰色。任何帮助将不胜感激。
修改
我添加了一个图像,其中包含我想要的所选区域作为相同的颜色。
答案 0 :(得分:1)
您可以在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>