Click here to Skip to main content
15,882,152 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello to all the friends of the forum: I have the following code in a purchase datagrid, where the trigger is activated if the purchase date field is blank, color the corresponding row with an alert color.
		<DataTrigger Binding="{Binding BuyDate}" Value="">
			<Setter Property="Background" Value="Orange"/>

The last row of the datagrid always has the date blank, but it does not color it, the other rows that meet the condition do color it. But if I am reviewing the rows from top to bottom of the datagrid, the color of the rows where the trigger is fulfilled, they lose their color, that is, how the trigger did not work and the color of the last row is also activated. I don't understand why this is happening, am I missing some detail?

Very grateful for the help.
(Sorry for my bad english)

What I have tried:

I'm new to WPF and can't find the proper documentation.
Updated 20-Dec-22 7:06am
Graeme_Grant 19-Dec-22 19:53pm    
Is the binding value null or default date?

You may need to use a IValueConverter[^] and return a value that the DataTrigger will recognize - in your case, an empty string.
Share this answer
I'll try it, thanks for the tip.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900