Hi, I am trying to get a datatrigger to work to change the background of a cell based on a value. I have read all of the previous posts on this subject and I am still not able to get it to work. I think I am having trouble figuring out that the path should be.
The following it my datatrigger style:
<Style x:Key="NegativePresenterStyle" TargetType="{x:Type igDP:CellValuePresenter}">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=EarnedBase}" Value="-88242.7">
<Setter Property="Background" Value="Red"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
I have also tried substituting path with the following which all give errors or don't do anything
(DataItem).EarnedBase
Record.DataItem
(Record.DataItem).EarnedBase
Record.DataItem.EarnedBase
The following is my field settings xaml:
<igDP:Field Name="EarnedBase" Label="Earned Base" Row="0" Column="1">
<igDP:Field.Settings>
<igDP:FieldSettings CellValuePresenterStyle="{StaticResource NegativePresenterStyle}" />
</igDP:Field.Settings>
"arwinl" wrote in message news:14861@forums.infragistics.com... Hi, I am trying to get a datatrigger to work to change the background of a cell based on a value. I have read all of the previous posts on this subject and I am still not able to get it to work. I think I am having trouble figuring out that the path should be. The following it my datatrigger style: <Style x:Key="NegativePresenterStyle" TargetType="{x:Type igDP:CellValuePresenter}"> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=EarnedBase}" Value="-88242.7"> <Setter Property="Background" Value="Red"></Setter> </DataTrigger> </Style.Triggers> </Style> I have also tried substituting path with the following which all give errors or don't do anything (DataItem).EarnedBase Record.DataItem (Record.DataItem).EarnedBase Record.DataItem.EarnedBase The following is my field settings xaml: <igDP:Field Name="EarnedBase" Label="Earned Base" Row="0" Column="1"> <igDP:Field.Settings> <igDP:FieldSettings CellValuePresenterStyle="{StaticResource NegativePresenterStyle}" /> </igDP:Field.Settings></igDP:Field> http://forums.infragistics.com/forums/p/2272/14861.aspx#14861
This does work. I was hoping the answer to the above question would help give me some insight into how to construct these paths. For some fields, I have to look at the data in a different column to determine whether to highlight it or not. Is there a way to do this?