How to create Componentreousrce key vis code bdhind?
===




how can  i write below code via code behind.

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

here is what i m doint.

  

  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;

    }