Click here to Skip to main content
11,488,877 members (78,104 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB WPF VB10.0 Color VB.NET .NET4 , +
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
AlternatingRowBackground
property only alternates every line, and I don't see how I could use
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 3-Apr-12 5:15am

1 solution

Rate this: bad
good
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
  Permalink  
Comments
thilitium at 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
0 Sergey Alexandrovich Kryukov 489
1 OriginalGriff 278
2 Maciej Los 170
3 _Asif_ 145
4 Sascha Lefèvre 135
0 Sergey Alexandrovich Kryukov 9,308
1 OriginalGriff 8,375
2 Sascha Lefèvre 3,334
3 Maciej Los 2,996
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 3 Apr 2012
Copyright © CodeProject, 1999-2015
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