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
715
Styling a cell - accessing the underlying cell?
posted

Hello all,

I have this style in my grid as follows:

<Style TargetType="{x:Type igDP:CellValuePresenter}"  BasedOn="{StaticResource {x:Type igDP:CellValuePresenter}}" >

<Setter Property="Background"
                              Value="{Binding .,
                              Converter={StaticResource StateToBackgroundBrushValueConverter}}" 
                              >

</Style>

I am trying to bind to the actual cell that is being styled, but using the above approach, it gives me the Record that the cell belongs to instead, which strikes me as odd. How can I get hold of the cell?

Thanks

 

Parents
No Data
Reply
  • 69686
    posted

    Hello,

    This is because the DataContext of the CellValuePresenter is the DataRecord itself. What you could do is modify the binding so that the path property points to the Value and you need to set the RelativeSource to Self. Another way would be to set the path to DataItem.PropertyName or Cells[X].Value  where X is either the index of the field or the name of the field.

Children