Hi,
I want to get rid of focus from ActiveCell and Selected cells in UltraGrid on clicking other controls of the form.
I am loading data using binding datasource .
I am using diffent back color for ActiveCell and Selected Cell.
When initially loaded I am not seeing any Activerow because I am using the following code.
grid.SyncWithCurrencyManager = false;grid.ActiveCell = null;
But once I select a cell I am not able to get rid of that focus from the cell.
I am able to clear the the selected cells bit still focus on active cell(i dont know wheather it is
really active cell because when I tried the following I got Active cell as null)
grid.Selected.Cells.Clear();grid.ActiveCell.Appearance.BackColor = "Yellow";(this line didnt work bcause ActiveCell is null).
then I tried
grid.Selected.Cells.Clear();grid.ActiveCell = null;
no result.
how can I clear the focus and also color form that Cell.
There is a knowledge base article here that describes how to remove the focus rectangle.
Thanks for th link. I still not able clear the focus. I did like below.
private
void btnClearAll_Click(object sender, EventArgs e){
grid.DrawFilter = noFocus;
grid.Refresh();
}
I'm I missing anything or shall I set any other properties?
Thanks
The code you have here will remove the focus rectangle from the grid. This is the dotted rectangle that appears around the active cell or row. This focus rectangle will not display when the grid control does not have focus, anyway, so that's probably not what you are asking about. It sounds like maybe you are talking about the appearances that are applied to the active cell and active row.
If so, then this should help:
FAQ:How do I turn off the ActiveRowAppearance so that the active row in the grid does not appear selected.
It also didn't work when I see on button click ActveCell = null and selected.Cells.Count = 0.
there is no focus but still one cell have same color as ActiveCell color.
I was trying to reset the Appearance of that cell but I can't do bcause ActveCell = null and selected.Cells.count = 0;
I'm afraid I don't understand what you are looking for, then. If the ActiveCell is null and there are no selected cells, then the grid cannot be displayed either an ActiveCellApparance or a selected cell appearance.
Perhaps you can post a small sample project or a screen shot of exactly what you are trying to remove.