I have a legacy .NET WinForms application that needs a modification. We're using an Infragistics UltraGrid
to display some information. The new requirement is that the grid must be "read-only" in certain circumstances. To that end, I've successfully set the grdMain.DisplayLayout.Override.AllowUpdate
, grdMain.DisplayLayout.Override.AllowDelete
and grdMain.DisplayLayout.Override.AllowAddNew
properties so that the grid is "read-only". But now I need to change the appearance of the grid so that it looks disabled. And this is where my trouble lies. I want to be able to toggle the grid's cell text and cell background color, etc. between looking enabled and disabled.
NOTE: I tried actually disabling the grid with
grdMain.Enabled
but when the grid is disabled, users cannot do "anything" with it like resize columns or highlight & copy text. So that was a bust.
I think I could brute force this and iterate bands and columns or rows and manually set colors, but it seems to me like Infragistics would have though of something like this and there should be a more graceful way of going about it. Any information you can provide would be appreciated.
You need to set Activation of either each row, each column or each cell in the grid in order to disable it. Keep in mind if you do so the users will not be able to select cells, nor the cells' text. The cells will be disabled - no highlight or copy text will be allowed.
Other approach you can take is set the cells' appearance. To set the appearance to all cells at once you can use CellAppearance of the Override object like this:
ultraGrid.DisplayLayout.Override.CellAppearance.BackColor = Color.LightGray;