0

Xceedデータグリッドコントロールを使用していて、ヘッダーの色を変更しようとしていますが、問題が発生しているようです。私が今持っているのは、次のコードスニペットです。

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

これはほとんどの部分で機能しますが、まだその周りに灰色が見られます。どんな助けでも大歓迎です。

編集

同じ色にしたい選択した領域の画像を追加しました。 ここに画像の説明を入力してください

4

1 に答える 1

2

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>
于 2012-12-04T11:24:55.200 に答える