I have a method that returns true or false.
I want this method to be binded to my DataTrigger
<DataGrid ItemsSource="{Binding Source={StaticResource SmsData}, XPath=conv/sms}">
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=check}" Value="true">
<Setter Property="Foreground" Value="Black" />
<Setter Property="Background" Value="Blue" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
</DataGrid>
if returned value is "true", then do the setter...
My Code:
public MainWindow()
{
DataContext = this;
InitializeComponent();
}
public string check
{
get
{
return "true";
}
}
How can I get this working ? I get an error now (in runtime, not crashing my program): BindingExpression path error: 'check' property not found on 'object' ''XmlElement'