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
225
Field property is Null in CellValuePresenter?
posted

I am trying to control the foreground color of cells in a XamTreeGrid. I do this within a converter like the following:

<Style TargetType="{x:Type dataPresenter:CellValuePresenter}"> 

<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource Self},

Converter={StaticResource ForegroundConverter}}" />

</Style>

 

Inside the converter I need to know the name of the field the CellValuePresenter is for (the coloring is dependent on the name of the field).


The converter looks like the following:

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)

{

     var cellValuePresenter = value as CellValuePresenter; // works

     var fieldName = cellValuePresenter.Field.Name; // Field is null!!

Any idea what is happening? Is there another way for me to retrieve the field from a CellValuePresenter (from inside the converter)? I am using 16.2.20162.1006.


Thanks,

Damon