I have a View in MVVM WPF project. I have a DataGrid in the Page bound to a DataView (from a DataTable). What I need is to use MultiDataTrigger for the background color of the DataGrid Rows, that should be redefined by True value of the ViewModel Property:
public bool IsAutorized
{
get { return _isAutorized; }
set
{
_isAutorized = value;
OnNotifyPropertyChanged("IsAutorized");
}
}
Whereas a True value is a property of DataRow. This is what I have now and the binding to the ViewModel property is not correct, when I set a breakpoint on the property get it is not "caught".
<Style.Triggers>
<Trigger Property="DataGridRow.IsSelected" Value="True">
<Setter Property="Background" Value="#CCDAFF"/>
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=IsAutorized,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Page}}" Value="True" />
<Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=IsNotSpecific}" Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Background" Value="#CCF4FF" />
</MultiDataTrigger> </Style.Triggers>
The Binding issues are very confusing, I've tried googleing it but found nothing. Any Ideas hot to do it?
Thank you.
-- EDIT:
"IsNotSpecific" and "IsSelected" are both Colmns in the DataView, that is taken from the DataTable, a Strongly Typed DataSet table.
When a row is selected the field / column "IsSelected" is set to true and a certain color is triggerd. When the View property "IsAutorized" is set to true and the DataRow (from the DataTable) "IsNotSpecific" column are set to "True", a different color should be displayed.