I'm binding my xamDataGrid with entity class. All of my xamDataGrid's columns are UnboundFields.
One of my entity class' field is used as a reference for row's color change but this field is not shown/displayed in my xamDataGrid. How can I achieve this?
Presently, I'm doing like this:
In my xamDatagrid.FieldLayoutSettings, I defined a style to override datarecordcellareastyle, named MeetingTaskGridStyle:
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings AutoGenerateFields="False" AutoArrangeCells="Never" DataRecordCellAreaStyle="{StaticResource MeetingTaskGridStyle}"/>
</igDP:XamDataGrid.FieldLayoutSettings>
This MeetingTaskGridStyle is defined like this:
<Style x:Key="MeetingTaskGridStyle" TargetType="{x:Type igDP:DataRecordCellArea}">
<Style.Resources>
<LinearGradientBrush x:Key="MouseOverBrush" StartPoint="0.5, 0" EndPoint="0.5, 1">
<GradientStop Color="#22000000" Offset="0" />
<GradientStop Color="#44000000" Offset="0.4" />
<GradientStop Color="#55000000" Offset="0.6" />
<GradientStop Color="#33000000" Offset="0.9" />
<GradientStop Color="#22000000" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="GreenBrush" StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="0.1" Color="#AA00CC00" />
<GradientStop Offset="0.8" Color="#55008800" />
<LinearGradientBrush x:Key="RedBrush" StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="0.1" Color="#AACC0000" />
<GradientStop Offset="0.8" Color="#55880000" />
<LinearGradientBrush x:Key="BlueBrush" StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="0.1" Color="#AA00AAAA" />
<GradientStop Offset="0.8" Color="#5500AAAA" />
<LinearGradientBrush x:Key="NoBrush" StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="0.1" Color="#AAAAAAAA" />
<GradientStop Offset="0.8" Color="#22AAAAAA" />
</Style.Resources>
<Setter Property="Padding" Value="0,4" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Border.BorderThickness" Value="0,0,0,0.5" />
<Setter Property="Border.BorderBrush" Value="LightGray" />
<Style.Triggers>
<DataTrigger Binding="{Binding Path=TaskCategory}" Value="0">
<Setter Property="Background" Value="{StaticResource NoBrush}" />
</DataTrigger>
<DataTrigger Binding="{Binding Path=TaskCategory}" Value="2">
<DataTrigger Binding="{Binding Path=TaskCategory}" Value="1">
<Setter Property="Background" Value="{StaticResource RedBrush}" />
</Style.Triggers>
</Style>
But this is not working :( Any help? I really need support for this one. Thank you very much.
I have found a solution.
Instead of this:
It should be:
<DataTrigger Binding="{Binding Path=DataItem.TaskCategory}" Value="0">