Have been up all night trying to figure this one out. I am using an Infragistics.Win.UltraWinGrid.UltraGrid. The DataSource for the grid is a BindingSource that uses a custom data structure. Binding and property updates are working fine. Grid is readonly.I want to change the color (toggle) of a row if the underlying value changes. Here is a very simplified snippet of my original code using the recommended InitializeRow event (note, for simplification I am just coloring the whole row for the example, whereas actually I am coloring a cell in my application):private void ugWatchlist_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e){ if (!e.ReInitialize) return; Infragistics.Win.Appearance app1 = new Infragistics.Win.Appearance(); app1.BackColor = Color.Green; Infragistics.Win.Appearance app2 = new Infragistics.Win.Appearance(); app2.BackColor = Color.Red; if (e.Row.Appearance.BackColor.Name != Color.Green.Name) e.Row.Appearance = app1; else e.Row.Appearance = app2;}However, the color change works only once (and rows turn red on the firs t update and stay that way). According to the code, the color should toggle on each update. I can confirm in the debugger that the BackColor property is indeed changed but not reflected by the UltraGrid.Am I missing something here? I have gone through all the samples and examples and couldn't find a solution to this problem. Please help.
Let me know how it goes. :)
hey Mike!! so sorry didn't see this email. i need email training apparently. i'm going to try this out today.
Hi Al,
This seemed like such a fun and useful idea that I whipped up a quick sample.
I have attached my sample here. All you have to do is instantiate an instance of the GridCellColorizer class and pass in your grid. Then, when you want to color a cell temporarily, you call the AddCell method on the GridCellColorizer and pass in the cell, the color, and the time in milliseconds. The GridCellColorizer takes care of the rest.
You didn't answer my question about whether you wanted to do this on cells or rows, so I went with cells. Rows might be a bit trickier as you would have to apply the appearance to each cell within row.
I chose to use a DrawFilter, instead of setting the Appearance on the cell for a number of reasons. First off, this will be a lot more efficient, since cells that are scrolled out of view can be ignored. Second, I decided to use a sort've fade-out effect by drawing over the cell with a semi-transparent color which would have been impossible using an Appearance.
thanks for responding Mike. not sure where to start. if using a ticker to declare it in the event everytime or declare globally. i would just change to a solid color for one second. like a blink i guess.
how long they have left to maintain that color....well i see it more as several rows blinking at practically the same time in wrong order. i might have to shelve this one for now.
There's no built-in support for this. But you could probably achieve something pretty nice using a Timer. You would need to have some sort of construct to track which rows need the color and how long they have left to maintain that color and then on each tick of the timer, you just adjust the appearance of those rows based on the elapsed time.
Are you talking about doing this for individual cells or just entire rows? What kind of effect are you looking for? Blinking, fadeout, or just a solid color?
The biggest challenge I foresee you having with this is the performance. But with the appropriate optimizations, I can't see any reason why this can't be done.