Click here to Skip to main content
15,894,294 members

WPF DataGrid alternating rows color relatively to data

thilitium asked:

Open original thread
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 !
Tags: Visual Basic (Visual Basic 10), .NET4, WPF, Color, DataGrid

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



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