Hi, I have a Ultragrid with multiple selection option enabled, and when i click a selected row to remove it from the selection, the row is still highlighted until i click another row, this is normal? is a bug? or i have to do something manually to remove the highlight? I tested in version 6.3 and 7.1 and happens in both versions.
Regards.
Hi,
There are a couple of possibilities.
First, clicking on a row will select it, never unselect it. To unselect a row, you need to click on it while holding the CTRL key.
If that doesn't help, it may be that the row is not actually selected, but rather Active. The default ActiveRowAppearance mimics the selected row appearance. So if that's the case, what you need to do is go into the property grid at Design-time and go to the grid.DisplayLayout.Override and find the ActiveRowAppearance and ActiveCellAppearance properties and Reset them.
In that case, I am pretty sure that my last paragraph above is the answer. If that row still appears highlight but is not in the Selected.Rows collection, it must be because that row is the ActiveRow, not a selected row. So you need to turn off the ActiveRowAppearance/ActiveCellAppearance.
Doing this in AfterSelectChange is a little wasteful. You only need to do this once, you don't need to do it for every row. I would recommend doing it at Design-time or in the InitializeLayout event of the grid.
Thanks for your answer, i solved the problem with the following code
private void ultraGridAttributes_AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { if (ultraGridAttributes.Selected.Rows != null) { if (!ultraGridAttributes.Selected.Rows.Contains(ultraGridAttributes.ActiveRow)) { ultraGridAttributes.DisplayLayout.Override.ActiveRowAppearance.BackColor = Color.Transparent; } else {
//The original highlight color ultraGridAttributes.DisplayLayout.Override.ActiveRowAppearance.BackColor = SystemColors.Highlight; } } }