如何通过代码隐藏来编写下面的代码。
<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;
}发布于 2015-04-09 14:42:04
替代属性的值für是笔刷。
例如:
recordstyle.Setters.Add(new Setter(DataRecordCellArea.ForegroundAlternateStyleProperty, Brushes.Red));任何画笔都是可能的。您不仅可以使用实心笔刷,如我的例子所示,您还可以使用渐变笔刷。
https://stackoverflow.com/questions/11412686
复制相似问题