Click here to Skip to main content
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 OriginalGriff 299
1 Maciej Los 295
2 Sergey Alexandrovich Kryukov 205
3 Aajmot Sk 202
4 Sinisa Hajnal 166
0 OriginalGriff 7,760
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,785


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 3 Apr 2012
Copyright © CodeProject, 1999-2014
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