Hi,
I have what I think is a fairly simple scenario. Instead of having the Background colour alternating on my rows I would like to keep this constant and have the Foreground style change instead. All the existing posts I've read seem to focus on Background and it appears that Foreground isn't working in the same way.
With the following xaml all my rows look the same, am I doing something wrong?
<Window x:Class="Infragistics.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dataPresenter="http://infragistics.com/DataPresenter"
Title="MainWindow"
Height="350" Width="525">
<Window.Resources>
<SolidColorBrush x:Key="DefaultBackground" Color="#FF3D3C3C" />
<SolidColorBrush x:Key="DefaultForeground" Color="Ivory" />
<Style x:Key="XamDataGridForegroundStyle" TargetType="{x:Type ContentPresenter}">
<Setter Property="TextBlock.Foreground" Value="{StaticResource DefaultForeground}"/>
</Style>
<Style x:Key="XamDataGridAlternateForegroundStyle" TargetType="{x:Type ContentPresenter}">
<Setter Property="TextBlock.Foreground" Value="Red"/>
<Setter Property="TextBlock.FontStyle" Value="Italic"/>
</Window.Resources>
<Grid Background="{StaticResource DefaultBackground}">
<dataPresenter:XamDataGrid DataSource="{Binding People}"
Background="{StaticResource DefaultBackground}">
<dataPresenter:XamDataGrid.Resources>
<Style TargetType="{x:Type dataPresenter:DataRecordCellArea}">
<Setter Property="Background" Value="{StaticResource DefaultBackground}" />
<Setter Property="BackgroundAlternate" Value="{StaticResource DefaultBackground}" />
<Style TargetType="{x:Type dataPresenter:CellValuePresenter}">
<Setter Property="ForegroundStyle" Value="{StaticResource XamDataGridForegroundStyle}" />
<Setter Property="ForegroundAlternateStyle" Value="{StaticResource XamDataGridAlternateForegroundStyle}" />
</dataPresenter:XamDataGrid.Resources>
<dataPresenter:XamDataGrid.FieldSettings>
<dataPresenter:FieldSettings />
</dataPresenter:XamDataGrid.FieldSettings>
<dataPresenter:XamDataGrid.FieldLayoutSettings>
<dataPresenter:FieldLayoutSettings HighlightAlternateRecords="True" />
</dataPresenter:XamDataGrid.FieldLayoutSettings>
</dataPresenter:XamDataGrid>
</Grid>
</Window>
Thanks,
Steve
Hello Steve,
I have logged this with development under ID: 142490 and I have also created a support ticket on your behalf: CAS-116452-Y5L5K6 and have linked the development issue to it, so that you can get automatically updated, when a Service Release containing the fix is available for download. You can get the new version from our website’s “My IG”, “My Keys & Downloads” tags: https://es.infragistics.com/Membership/Default.aspx?panel=Downloads#Downloads
You can also monitor the support ticket’s progress through the “My Support Activity” tag: https://es.infragistics.com/Membership/MySupport.aspx
Meanwhile you can use the sample I attached, where I used Trigger in order to change the Foreground.
Hi.
This sample doesn't work. Not change the foreground color.
I use Infragistics 14.2.
Please, Let me know to way to change the foreground color on alternating rows.
Thank you.
Hello,
You can use the sample from one of the previous replies (XamDataGridForegroundAlternate.zip).
Hope this helps.
For me foreground color on alternating rows working only on mouse over of cell.