Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi everybody !
I hoped this one was a simple one, but I'm quite new to WPF, so I didn't found an answer yet.

Here is the problem :I got a simple WPF Datagrid (.Net 4.0) storing reports, sorted by date. I want all the entries in the datagrid of the same day to be in one color, and alternate with another one for the other day.
Let's say for exemple, that all pair days number lines have to be red, and the other green.
The
VB
AlternatingRowBackground
property only alternates every line, and I don't see how I could use
VB
AlternatingCount
in this context...
And, i actually got a "Date" column in the Grid.

I think it has something to do with templates or triggers, am I right ?

Thanks in advance for your help !
Posted

1 solution

Some things are much easier done in code behind. You can set up a LoadingRow event on your data grid. Then, in the event, set the row background based on whatever criteria you want.

Good Luck
 
Share this answer
 
Comments
thilitium 4-Apr-12 5:51am    
That's what I've done, but not what I asked, I'm really looking for a way of doing it in XAML...

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



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