Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
Update cell background on value change for UltraGrid (data bound) using InitializeRow event
posted

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.

Parents
  • 4555
    posted

    Hi,

    I suggest you try with a different version of NetAdvantage and see if the error is still happening. If the issue is not resolved then submit a case to developer support.

    Magued

Reply Children