Apologies if this has been answered before, but I can't find anything relevant.I have a grid, which is coloured by row, so I've changed the row Appearance BackColor and ForeColor. The grid default CellClickAction is RowSelect. But on certain columns of data I need to edit the cell, so on these columns I've set CellClickAction to CellSelect and I've enabled editing by double clicking on the cell.My problem is I can drag a selection over the cells which are set to CellSelect. Can I disable this anywhere? At the moment I'm setting cell.SelectedApperance BackColor to Transparent and ForeColor to Black which isn't ideal.Also, can I prevent ActiveCellAppearance from overridding my Row Appearance colours? The only way I can see to do this is by setting ActiveCellAppearance.BackColor to Color.Transparent, but then I have a problem with my ForeColor as this is different per row so I can't set it to one specific colour.Thanks,Campbell
Hi Campbell,
jcwild said:My problem is I can drag a selection over the cells which are set to CellSelect. Can I disable this anywhere? At the moment I'm setting cell.SelectedApperance BackColor to Transparent and ForeColor to Black which isn't ideal.
I'm not sure I understand what you mean here. Why is selecting the cells a problem? Are you saying that you don't want the users to be able to select certain cells, but that they need to be able to select ranges of cells that do not include the editable one? Seems like an unusual UI and I'm not sure why you would want that.
The only way I can think of to acheive something like that would be to handle the BeforeSelectChange event and cancel it if the new selection includes a cell you don't want.
jcwild said:Also, can I prevent ActiveCellAppearance from overridding my Row Appearance colours? The only way I can see to do this is by setting ActiveCellAppearance.BackColor to Color.Transparent, but then I have a problem with my ForeColor as this is different per row so I can't set it to one specific colour.
Again, I am a little confused by the question. It sounds to me like you simply don't want an ActiveCellAppearance on the grid at all. If that's the case, then you can simply Reset it or set the BackColor and ForeColor to Color.Empty (not Color.Transparent).
Hi Mike,
Yes, you are correct - I don't want the user to be able to drag a selection of cells - only to select individual cells. Is there a setting for this?
I also don't want the ActiveCellAppearance overriding any individual RowAppearance or CellAppearance that happens to be on the active cell. I tried setting .Override.ActiveCellAppearance to Nothing, and setting ActiveCellAppearance.BackColor to Color.Empty (and Color.Transparent) and it keeps overriding any CellAppearance I have set on that cell with a white cell. How can I prevent this?
Cheers,Campbell
jcwild said:Yes, you are correct - I don't want the user to be able to drag a selection of cells - only to select individual cells. Is there a setting for this?
Oh, okay, that's easy:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.Override.SelectTypeCell = SelectType.Single; }
jcwild said:I also don't want the ActiveCellAppearance overriding any individual RowAppearance or CellAppearance that happens to be on the active cell. I tried setting .Override.ActiveCellAppearance to Nothing, and setting ActiveCellAppearance.BackColor to Color.Empty (and Color.Transparent) and it keeps overriding any CellAppearance I have set on that cell with a white cell. How can I prevent this?
FAQ:How do I turn off the ActiveRowAppearance so that the active row in the grid does not appear selected.
If that doesn't work, then the appearance may be coming from AppStylist. Are you loading a style library?
I had hoped to set the critical aspects of appearance at a high level and let inheritance take care of composing them with a cell's special color. But I see your point about using cell.SelectedAppearance, and I didn't know about the new cell.ActiveAppearance in v9.2. Thank you.
Hi,
bobgru said:If this is confusing, I can repackage my unit tests as a sample app for you.
This is a bit confusing. But I probably don't need to understand exactly what you want to do in order to help you out here.
This is probably not going to be doable in v9.1 without some major coding using DrawFilters.
But... one thing that will help you is that there is a SelectedAppearance property on the Cell. So you can control the appearance of the cell in great detail when the cell or row is selected.
There is no such property for ActiveAppearance on the cell, though. At least, not in v9.1. This is a new feature we just added to v9.2. So you might want to consider upgrading and it will make this a lot easier.
Somewhat related to this, I am struggling to control the BackColor property of a selected cell. I am using v9.1.
I want to use a cell's background color for a special purpose, so I need to use other appearance properties to indicate activation or selection. For example, a cell might be red to indicate something. When inactive, it would be solid red. When selected, it would be a gradient from slightly lighter to slightly darker red. When active, it would be a gradient between the same colors but with a bright glossy highlight.
Furthermore, I want to have multiple rows of different colors, participating in multiple selection.
This appearance strategy only works for single-selection, because I have been unable to get my desired BackColor without setting it at band-level which affects all selected rows.
I had hoped the override hierarchy of Appearance objects could be manipulated to get the desired effect. By testing I determined the override hiearchies (highest to lowest precedence) of cells in various states.
For an unselected, inactive cell:
cell.Appearancerow.CellAppearancecolumn.CellAppearancerow.Appearanceband.CellAppearancegrid.CellAppearanceband.RowAppearancegrid.RowAppearance
When nothing is set but the default grid appearance, its BackColor is ignored and Color.Window is used instead.// grid.Appearance
For an active selected cell in an active selected row:
band.Override.ActiveCellAppearanceband.Override.ActiveRowCellAppearanceband.Override.ActiveRowAppearancegrid.DisplayLayout.Override.ActiveCellAppearancegrid.DisplayLayout.Override.ActiveRowCellAppearancegrid.DisplayLayout.Override.ActiveRowAppearancecell.SelectedAppearanceband.Override.SelectedCellAppearanceband.Override.SelectedRowAppearancegrid.Override.SelectedCellAppearancegrid.Override.SelectedRowAppearance
If none of the above are set, BackColor always resolves to Color.Highlight, which I don't set anywhere. The following are either ignored or lower in the hierarchy than an appearance I have not listed:
//cell.Appearance//row.CellAppearance//column.CellAppearance//row.Appearance//band.CellAppearance//grid.CellAppearance//band.RowAppearance//grid.RowAppearance//grid.Appearance
I am not using a style library, and I reset all the non-null appearance objects listed.
Did I miss an Appearance object that is supplying the Color.Window and Color.Highlight settings I see?
Is it possible to have multiple BackColor values within a collection of selected rows or cells? Note that BackColor2 seems to allow it.
If this is confusing, I can repackage my unit tests as a sample app for you.
Thanks