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
On a related note, is it possible to have the converter return a CellValuePresenter which can then be used?
So instead of binding all the properties to different values each with their own converter, I'd rather just define the CellValuePresenter in code and supply that back.
Yep null each time.
I would recommend going through this blog post and the sample included in case you haven't looked at it yet.
The converter could bring a null value in some cases. Does it return null every time the Convert method is called?
Tried doing
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource Self}, Converter={StaticResource StateToBackgroundBrushValueConverter}}" > </Setter>
In my converter I get passed the CellValuePresenter, but it seems to have nothing on it, so field etc is null.
{CellValuePresenter: DataRecord- -1 State: [null]} base {Infragistics.Windows.DataPresenter.DataItemPresenter}: {CellValuePresenter: DataRecord- -1 State: [null]}
Any ideas why this would be?
Yes, the CVP has both Record and Field properties which you can use. Another way would be to use a MultiValueConverter which supports binding to multiple values.