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
180
Problem with DataTrigger
posted

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>

Parents
  • 8576
    Offline posted
    Hi -
     
    Try setting the Path in your DataTrigger to Value (this is the name of the property on the CellValuePresenter that contains the cell's value):
     
    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Value}" Value="-88242.7">
     
    Joe Modica

     

    "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

Reply Children