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
465
UltraGrid - How to override ActiveRowAppearance properly?
posted

Hello,

The ActiveRowAppearance seems a bit flaky to me or I am just too new to this.

If a certain property on the active row is set then it should show the forecolor as red, otherwise standard white.
However the red never shows up with code as below, unless I uncomment the line with ForeColor.white ,
which results in a forecolor black (insteadof white) for rows without CancelJobID set and red for rows with that condition set.

Can somebody help me please?

Many Thanks,
Houman

private void entityScheduleDefinitionUberGrid_InitializeRow(object sender, InitializeRowEventArgs e)
{
      if(((UIScheduleDefinition)e.Row.ListObject).CancelJobID.HasValue)
             entityScheduleDefinitionUberGrid.DisplayLayout.Override.ActiveRowAppearance.ForeColor = Color.Red;
     
else
     
{
             entityScheduleDefinitionUberGrid.DisplayLayout.Override.ActiveRowAppearance.ForeColor =
Color.Empty;
             entityScheduleDefinitionUberGrid.DisplayLayout.Override.ActiveRowAppearance.ForeColor =
Color.White;
     
}
}

  • 469350
    Suggested Answer
    Offline posted

    Hi Houman,

    It looks like me like you are trying to change the appearance of the row based on a value of a cell in that row. If that's the case, then you probably want to use the Appearance property on the row.

    e.Row.Appearance

    The ActiveRowAppearance is an appearance that is defined on the Override level. This means that it applies to all rows in the grid or all rows in a particular band. So it does not really make sense to change the ActiveRowAppearance inside the InitializeRow event, because you would be changing the appearance of the active row based on a completely arbitrary row's value.