1
我怎樣才能通過後面的代碼寫下面的代碼。如何通過後面的代碼創建ComponentResourceKey?
<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;
}