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
1024
CellValuePresenter Style
posted

Hi,

I want to background one column's cells according to the value in another cell.

I have created a style which works great:

 

 

 

 

 

 

<

 

Style x:Key="vlBackgroundStyle" TargetType="{x:Type igDP:CellValuePresenter}">

 

 

 

 <Style.Triggers>

 

 

 

  <DataTrigger Binding="{Binding Path=Cells[6].Value}" Value="True">

 

 

 

   <Setter Property="Background" Value="Green" />

 

 

 

  </DataTrigger>

 

 

 

 </Style.Triggers>

 

 

 

</Style>

the only problem is that it applies to all cells. i want the style to apply only to one cell.

how do I accmplish that?

I figured I need to do simething like

 

 

 

 

 

 

 

 

<igDP:Field Name="Value" Label="Value">

 

 

 

 <igDP:Field.Settings>

 

 

 

  <igDP:FieldSettings CellValuePresenter="{StaticResource vlBackgroundStyle}"/>

 

 

 

 </igDP:Field.Settings>

 

 

 

</igDP:Field>

but that's not the correct syntax... Thank You

Parents
  • 69686
    posted

    Hello,

    This is the correct syntax but probably the XamDataGrid has autogenerated a FieldLayout and is using it rather than the one you have applied the style to. Have you set AutoGenerateFields to false? Moreover, you can try setting the style in code behind - FieldLayoutInitialized event.

Reply Children