I have a WPF DataGrid which is populated from a database. There is a cell which gives me a count. I want to add a flashing Background color to that cell if its value is more than 0. Thanks for helping me with my problem.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Create a converter that will check to see if a cell contains a number greater than 0:
Include your converter namespace in the xaml. Replace
MyAppwith the namespace of your converter:Your grid will have to look something like this. The objects I am binding to have 2 properties: Col1 and Col2. If the value of Col1 is greater than 0, that cell will flash red.
Edit
If you have to make cells in multiple columns blink based on what they contain, you can change
To
And set the CellStyle for each of the columns that you want to blink to our FlashStyle:
Note that this will probably only work with DataGridTextColumns. If you are using DataGridTemplateColumns it will be a bit more tricky.