On the below style, I have the background set to Yellow, if there converter on the datatrigger passes true, the background is blue.
That all works fine. However, I set the BackgroundSelected to Green, and that also works fine, except for the cells which the converter is passing true, in which case it is stuck on blue when selected. How would I be able to set the backgroundselected to green when the datatrigger passes true?
<Style x:Key="SampleStyle" TargetType="{x:Type igWPF:CellValuePresenter}" >
<Setter Property="Background" Value="Yellow"/>
<Setter Property="BackgroundSelected" Value="Green"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Record.DataItem.CHN, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type igWPF:DataRecordCellArea}}, Converter={StaticResource SampleStyleConverter}}" Value="True">
<Setter Property="Background" Value="Blue"/>
</DataTrigger>
</Style.Triggers>
</Style>
Created a sample project to demonstrate the issue.
Hello Michael and thank you for posting!
Setting the Background property in a DataTrigger prevents the template triggers in the default CellValuePresenter template from working. You can modify the default template that is located at C:\Program Files (x86)\Infragistics\2014.1\WPF\DefaultStyles\DataPresenter\DataPresenterGeneric_Express.xaml or add MultiDataTrigger to set the Background property as so:<MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding Path=Record.DataItem.Chain, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type igWPF:DataRecordCellArea}}, Converter={StaticResource Conv}}" Value="True"/> <Condition Binding="{Binding IsSelected}" Value="False"/> <Condition Binding="{Binding IsActive}" Value="False"/> </MultiDataTrigger.Conditions> <MultiDataTrigger.Setters> <Setter Property="Background" Value="Cyan"/> </MultiDataTrigger.Setters> </MultiDataTrigger> If you have further questions, do not hesitate to ask.