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
1640
Cell content issues
posted

We have two situations where we are modifying cell content and/or properties, and not getting the result we are looking for, as follows:

1. We want to be able to selectively hide and/or show grid columns (after the grid has been initialized) on auto fit grids.  Our existing logic works fine - it sets the widths properly and the grid auto-sizes correctly.  The problem is that the formerly hidden column is displayed with a grey (disabled) color.  I can change the ForeColor and ForeColorDisabled properties to black, but then the cell contents will be also be black on the highlighted row.  How can we revert the row to normal fore colors?

2. We want to display buttons in a grid column only on certain rows, and have the button cell be blank on the other rows.  So I have defined the button column initially with style = Default, and then change it to Button when I load the image.  But my routine is not working - the buttons do not appear at all - how should this be fixed?

public static void SetGridCellImage(UltraGridRow row, string columnName, object image = null)

{

    try

    {

        if (row != null && !string.IsNullOrWhiteSpace(columnName))

        {

            UltraGridCell cell = row.Cells[columnName];

            if (cell != null)

            {

                cell.Column.Style = (image == null)

                    ? Infragistics.Win.UltraWinGrid.ColumnStyle.Default : Infragistics.Win.UltraWinGrid.ColumnStyle.Button;

                

                                 cell.ButtonAppearance.Image = image;

            }

        }

    }

    catch

    {

    }

}

Parents Reply Children