Click here to Skip to main content
13,044,428 members (112,693 online)
Rate this:
Please Sign up or sign in to 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.
property only alternates every line, and I don't see how I could use
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 3-Apr-12 4:15am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 3 Apr 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100