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
815
Problems with generic cells
posted

Hello again,

Ok, so i have the following problem:

I have a xamdatagrid linked to a datatable that is dynamically created. I store the index of some columns and after that, depending on the value of each cell, I insert a picture. 

I have the following code and trigger, pretty simple:

 

  private void dg_InitializeRecord(object sender, InitializeRecordEventArgs e)

        {

            e.Record.FieldLayout.Fields[myDynamicIndex].Settings.CellValuePresenterStyle = dg.FindResource("st") as Style;

        }

 

 

<ControlTemplate.Triggers>

                                    <DataTrigger Binding="{Binding Path=Cells[ ? MY PROBLEM ? ].Value, Mode=OneWay}" Value="1">

                                        <Setter Property="Visibility" TargetName="green" Value="Hidden"/>

                                        <Setter Property="Visibility" TargetName="red" Value="Visible"/>

                                    </DataTrigger>

 </ControlTemplate.Triggers>

 

 

As you can see, i cannot get the index of the cell in xaml, as it is dynamically set in my .cs code. I tried the following but it didn't work

 

Binding="{Binding Value, 
RelativeSource={RelativeSource AncestorType={x:Type igDP:Cell}}}"

Can anyone help?

 

 

Parents Reply Children