Sometimes I lock my Winforms UltrGrid columns, depending on application variables. If the user saves the grid layout while those columns are locked, I cannot unlock the columns.
If blnMyProgramCondition Then grdGrid.DisplayLayout.Bands(0).Columns("Entity").CellActivation = Activation.Disabled grdGrid.DisplayLayout.Bands(0).Columns("Entity").CellAppearance.ForeColorDisabled = Color.Black grdGrid.DisplayLayout.Bands(0).Columns("Entity").CellAppearance.BackColor = Me.BackColor Else grdGrid.DisplayLayout.Bands(0).Columns("Entity").CellActivation = Activation.AllowEdit End If
If blnMyProgramCondition Then
grdGrid.DisplayLayout.Bands(0).Columns("Entity").CellActivation = Activation.Disabled
grdGrid.DisplayLayout.Bands(0).Columns("Entity").CellAppearance.ForeColorDisabled = Color.Black
grdGrid.DisplayLayout.Bands(0).Columns("Entity").CellAppearance.BackColor = Me.BackColor
Else
grdGrid.DisplayLayout.Bands(0).Columns("Entity").CellActivation = Activation.AllowEdit
End If
The above works fine unless I load the grid layout first (in which the columns were locked before saving):
grdGrid1.DisplayLayout.LoadFromXml("MyLayout.xml")
Cells in the grid will take on the least accessible Activation setting. So, for example, if you disable editing in the entire grid, or on the Override, then nothing you do on the cell, row, or column will re-enable editing in that cell.
So what's most likely happening here is that your layout is applying a setting to your grid that is disabling editing on a higher level, like the DisplayLayout or the Band which is essentially overriding the CellActivation setting on the column. So the simplest thing for you to do would be to load the layout and then examine the CellActivation property on the Band and the DisplayLayout over your grid to see which one is doing it, and then undo that setting.
So take a look at these two properties: Me.UltraGrid1.DisplayLayout.Override.AllowUpdate Me.UltraGrid1.DisplayLayout.Bands(0).Override.AllowUpdateChances are, one of them is set to DefaultableBoolean.False and that's what is stopping you from editing the column. If that doesn't help, zip up your layout file and attach it here and we can take a look at it and see if we can figure out what's disabling editing. :)
Locked for editing; the cursor can enter the cell but you can't edit or change anything, and the drop down button is disabled. This is what I want in certain circumstances. However, after doing the DisplayLayout.LoadFromXml("MyLayout.xml") I don't seem able to re-enable the locked columns. Sorry I don't have a sample - the screen actually has 6 grids on different tabs and is part of a much larger application. Extracting it for a demo would be a job in itself.
Hello Ted,
Thank you for contacting Infragistics Developer Support!
What do you mean when you say the columns are locked?Do you have a sample you can attach?