Using the 10.2 version of the grid or presenter i'm trying to add a datatrigger on the grid which does something visible, like making the font bold. This datatrigger should be databinded to a property of the dataitem but somehow i'm not able to figure this out in xaml. I found a multitrigger that listens to IsDataChanged and makes selectorDataChanged visible, but the value of this property is often false while the object is in fact dirty.
I tried several style's like
<Style TargetType="{x:Type igDP:RecordPresenter}"> <Style.Triggers> <DataTrigger Binding="{Binding DataItem.IsDirty}" Value="True"> <Setter Property="Background" Value="Green" /> </DataTrigger></Style.Triggers></Style>
but nothing works.. using TargetType igDP:DataPresenter or something else doesn't work either.
Hi,
I understood you the previous time an yet there is no direct access to the Cell class that you can use. My example was to show how to do a binding for the Field indexed 0. You can set such a style of your first Field’s CellValuepResenterStyle property.
Please let me know if you require any further assistance on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
Hello Petar,
Thanks but I'm seeking a binding path pointing on the Cell resolved from the Field property of the CellValuePresenter:
ie: Path=Record.Cells[Field].IsDataChanged (impossible due to binding limitation on indexers )
Thanks
Hello,
Here is a xaml snippet that allows you access to the first Cell’s IsDataChanged property:
<Style TargetType="{x:Type igDP:CellValuePresenter}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Record.Cells[0].IsDataChanged,RelativeSource={RelativeSource Self}}" Value="True">
<Setter Property="FontWeight" Value="Bold"/>
</DataTrigger>
</Style.Triggers>
</Style>
Hope this helps.
Helly Alex,
Is there a way to create a Trigger binded to the property "Cell.IsDataChanged" from a CellValuePresenter Style?
<Style TargetType="{x:Type igDP:CellValuePresenter}"> <Style.Triggers> <DataTrigger Binding="{Binding (???).Cell.IsDataChanged }" Value="True"> <Setter Property="FontWeight" Value="Bold" /> </DataTrigger> </Style.Triggers> </Style>
You would have to create a property, because you will not be able to set the trigger to the method. Another thing that you can try is the IsDataChanged property of the Cell itself. This property will be true if the cell's value has not yet been committed to the underlying data source.