I am trying to create a style for my XamDataGrid so that I can determine what values to show in a tooltip based on the current cell that is being hovered over.
I am trying the below:
<Style x:Key="MyCVPStyle" TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="ToolTip">
<Setter.Value>
<StackPanel>
<ListView ItemsSource="{Binding RelativeSource={...}, Path=Field, Converter={StaticResource MyFieldConverter}}">
...
The DataContext of the style is set to the DataRecord. The problem I am having is that I do not know how to access the actual field of the cell value presenter.
I tried setting the source to:
{Binding RelativeSource={RelativeSource AncestorType={x:Type igDP:CellValuePresenter}}, Path=Field
but that fails with a binding error:
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Infragistics.Windows.DataPresenter.CellValuePresenter', AncestorLevel='1''. BindingExpression:Path=Field; DataItem=null; target element is 'ListView' (Name=''); target property is 'ItemsSource' (type 'IEnumerable')
How can I access/bind to the CellValuePresenter.Field so I can pass that value to my converter?
As a reference, I have other CellValuePresenter styles that work without issue where I access the Field. For example, here the second binding param is the Field, accessed by referencing Self:
<Setter Property="BorderThickness">
<Setter.Value>
<MultiBinding Converter="{StaticResource BorderThicknessConverter}">
<MultiBinding.Bindings>
<Binding Path="DataItem" />
<Binding RelativeSource="{RelativeSource Self}" Path="Field" />
</MultiBinding.Bindings>
</MultiBinding>
</Setter.Value>
</Setter>