Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1325
Wrong background returned by DataRecordPresenter.Background property
posted

Hi. I'm trying to get row background color in the code:

DataRecordPresenter presenter = RecordPresenter.FromRecord(grid.Records[0]) as DataRecordPresenter;
Color backgroundColor = ((SolidColorBrush) presenter.Background).Color;

This code returns color #00FFFFFF, but actual bakground color is #FFAFEEEE. It is set by the converter. The DataRecordCellArea style:


<Style x:Key="DataRecordCellAreaBaseStyle" TargetType="idp:DataRecordCellArea" BasedOn="{StaticResource TrackingGridRowDefaultStyle}">
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.BuySell,
Converter={conv:BuySellToBrushConverter}, ConverterParameter={x:Static conv:BuySellToBrushConverter.BackgroundParameter}}" />
<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.BuySell,
Converter={conv:BuySellToBrushConverter}, ConverterParameter={x:Static conv:BuySellToBrushConverter.ForegroundParameter}}" />
</Style>

Why I can't get correct background color?

Parents Reply Children
No Data