1

我如何通过后面的代码编写下面的代码。

<Style x:Key="{ComponentResourceKey {x:Type igDP:XamDataGrid}, GrayForegroundStyle}">
    <Setter Property="TextBlock.Foreground" Value="#FF333333" />
</Style>

这就是我所做的。

void ApplyRecordAreaStyle()
{
    Style recordstyle = new Style(typeof(DataRecordCellArea));

    recordstyle.Setters.Add(new Setter(DataRecordCellArea.BackgroundAlternateProperty, SelectedBackground));
    recordstyle.Setters.Add(new Setter(DataRecordCellArea.ForegroundAlternateStyleProperty, ????????));

    xamGrid.FieldLayoutSettings.DataRecordCellAreaStyle = recordstyle;
}
4

1 回答 1

0

替代属性的值是画笔。

例如:

recordstyle.Setters.Add(new Setter(DataRecordCellArea.ForegroundAlternateStyleProperty, Brushes.Red));

任何刷子都是可能的。您不仅可以使用我的示例中所示的实心画笔,还可以使用渐变画笔。

于 2015-04-09T06:42:03.797 回答