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.
I figured it out
Orange because i'm from the netherlands and we're going to win the finals :)I have yet to figure out how to set the text font to bold.
Hello Raymond,
Have you tried targeting the same style for the CellValuePresenter instead of the DataRecordPresenter?
Creating a setter for the FontWeight property should bold the content of the cells in that row when IsDirty is true. Let me know if you have tried that already.
I am also from Europe so I am hoping any Europe team wins.
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.
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>
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.
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
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.