The Goal is to color the cell CDvi_CodDvi : red if CDvi_CodCli = 0 and blue if not .
The following Xaml dot work ( i work with thee sample of infragistic )
The converter : passingToColorConverter is good.
Where is the error
thank you Caiseodev
<igDP:XamDataPresenter Name="XDPDevis" SelectedItemsChanged="XDPDevis_SelectedItemsChanged" RecordActivated="XDPDevis_RecordActivated">
<igDP:XamDataPresenter.FieldSettings>
<igDP:FieldSettings AllowEdit="False" />
</igDP:XamDataPresenter.FieldSettings>
<igDP:XamDataPresenter.FieldLayoutSettings>
<igDP:FieldLayoutSettings AutoGenerateFields="False"/>
</igDP:XamDataPresenter.FieldLayoutSettings>
<igDP:XamDataPresenter.FieldLayouts >
<igDP:FieldLayout >
<igDP:FieldLayout.Fields>
<igDP:Field Name="CDvi_CodDvi" Label="Code" Width="70" >
<igDP:Field.Settings>
<igDP:FieldSettings CellWidth="70" LabelWidth="70">
<igDP:FieldSettings.CellValuePresenterStyle>
<Style TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="Background"
Value="{Binding Path=Cells[CDvi_CodCli].Value, Converter={StaticResource passingToColorConverter}}">
</Setter>
</Style>
</igDP:FieldSettings.CellValuePresenterStyle>
</igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="CDvi_CodCli" Label=" Client" Width="30"></igDP:Field>
<igDP:Field Name="NomCli" Label=" Client" Width="120"></igDP:Field>
<igDP:Field Name="CDvi_DatDvi" Label="Date" Width="70"></igDP:Field>
<igDP:Field Name="CDvi_DesDvi" Label="Designation" Width="150"></igDP:Field>
</igDP:FieldLayout.Fields>
</igDP:FieldLayout>
</igDP:XamDataPresenter.FieldLayouts>
</igDP:XamDataPresenter>
Hello,
Thank you for the post. I have been looking into your question and I am attaching a sample application(DynamicStyling.zip) where I have shown how you can achieve the desired functionality.
If you need any further assistance on this matter, feel free to ask.
Thank you so much. It's Work fine.
Just other question :
<Setter Property="Background" Value="{Binding Path=Value, RelativeSource={RelativeSource Self}, Converter={StaticResource doubleToColorConverter}}"/>
In this line : what means : RelativeSource={RelativeSource Self},
CaiseOdev
Thank you for your feedback. I have used ‘RelativeSource Self’ in order to bind the ‘Background’ property to itself and manipulate it through converter. For more information regarding RelativeSource, please look through the following MSDN link :
http://msdn.microsoft.com/en-us/library/dd553635(v=vs.95).aspx
I Have read the link of ‘RelativeSource Self’.
But my problem is to color a cell with test of a other cell.
In your sample : color the cell : 'firstName' and test cell 'probation.
Excuse me for my explanations
thank you CaisseOdeV
According to your last post I understand that you would like to change the Background of filed’s cells according to the value of the cells of another field in the XamDataGrid. I have modified my sample application(DynamicStylingModified.zip) in order to meet exactly this scenario.
If I have misunderstood you in any way, feel free to ask.
Ok , It's Work Fine.
I made a lot of progress to DataPresenter with you.
Thank You Caisseodev