I saw the wingrid has a status that the row is bounded by doted line (No cell is selected) and using up and down button, it will navigate the whole next row. How can I trigger this event???
Thank You!
Hi,
I'm not really sure what you mean by "trigger this event". What event are you referring to?
Do you mean you want the grid to enter a state where it has an active row (with a focus rectangle), but no selected row?
Do you want to do this programmatically? Or do you want to enforce that this is always the case and not allow the user to enter edit mode in a cell?
Hi Mike,
My stituation is that....
Actually, my problem is that the dotted rectangle in a selected row or cell in the grid.
For me, I have already Overrides the SelectTypeCell and SelectTypeRow to None, but it's still happen.
For row, when user click the line between two row, the dotted line rectangle appear and active cell become null (I have to handle this stituation for my business logic)
For cell, this dotted rectangle appear when user press "Esc" (Anyway, I have override the keypress event), or scroll the records by mouse wheel (As attached)
Can anyway to disable this selection ???
Regards
Andrew
Hi Andrew,
The dotted line you show here is called the focus rectangle. It has nothing to do with selection, it indicates the active control on a form and specifically the active cell or row in the grid.
Here's a KB article that shows how to turn this off for any Infragistics Winforms control:
HOWTO:How can I turn off the Focus Rectangle on an Infragistics Win Control?
Ths for your quick reply, but I think there is some misunderstanding~ The one I mention is that, even I dont want the use has any change to select a cell or a row... or I would say, the cell of the grid can only be in EditMore whatever I scroll by mouse wheel or click the line between two row accidiently.
Thank You for your solution.
Andrew ^^
I'm afraid I do not understand what you are saying here.
Sorry about my poor english. I would like to know what event will fire to show up the Focus Rectangle. I dont want this event fire because my application requirement is not allow the user to select a row, and all the cell should be in EditMode (When Focus Rectangle appear in a cell or a row like my attached photo above, the cell cannot be edit which is not allow in my user requirement). I used your code to hide the focus rectangle, however, it just Hide... the cell is still NOT in Editable mode.
Thank You For your help.
It sounds to me like you are clicking on the row and not on a cell. Depending on the grid setting, there's a small area where the cell does not cover the row. So if the user clicks on that area, the row gets activated rather than the cell.
There's no easy way around that. You might try setting the BorderStyleRow property to None. That should make the rows in the grid overlap by a pixel and that might eliminate the spacing.
Another option would be to use the MouseDown event of the grid and use the UIElements to try to get a CellUIElement. If you fail to get a CellUIElement, you could trap for a RowUIElement, instead, and if you get one, you know that the user clicked on one of those spaces. You could then try to find the nearest cell. This would not be trivial, but these two articles should point you in the right direction:
HOWTO:UltraWinGrid Mouse Position and Cell Identification
HOWTO:UltraWinGrid Mouse Position and Row Identification
The X here probably doesn't matter all that much, it's really the Y that is the problem and it will only be off by maybe 1 or two pixels tops. So I would just try calling UIElementFromPoint for one pixel up and one pixel down to see if you can get a CellUIElement.
Your solution is fit for me. Thank You so much.
One more question, how can I get the nearest cell by X Y mouse coordination? Thank You for your help.