Hi,
I'm using an UltraWinGrid (version 11.1.20111.1003).
When right clicking on a row selector, the previous selected line is kept, which is not what I expect (previous selected row should be unselected). How can I disable this behavior?
Hello tfresnea,
If you would like to have just a single row selected, than I suggest you to set the SelectTypeRow of the Override object to Single in the InitializeLayout event of the UltraGrid like:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Single; }
Please let us know if you have any other questions with this matter.
Hi Danko,
I'd like to allow the user to select multiple rows when he presses Ctrl or Shift. But I don't want that right click on the row selector keeps the previous selection. Thus, unfortunately, your solution will not be satisfactory to me.
I will provide you another approach then.
What you could do on mouse click is to verify if you clicked right button, and if you are already over an row selector, to clear the SelectedRows collection and just to select the row associated with this row selector.
If this approach suits your requirements, I could provide you also some code snippet to achieve the above.
Please feel free to let us know if you have any other questions with this matter.
I expected a property on the row selector to do that but your approach should provide the behavior I'm expecting in the end.
Is there an easy way to know that I'm clicking on a row selector?
Hello Tfresnea,
Thank you for your feedback.
If you have any other questions please do not hesitate to contact us.
Actually I edited my answer after posting it, so yes I have another question :)
Is there an easy way to know that I'm clicking on a row selector? Do I need to check if the position of the row selector and the mouse event arg position are matching (which I would like to avoid)?
There is another way to achieve that. You could use MouseEnterElement and MouseLeaveElement for example to verify if you are clicking over a row selector or not. One possible code snippet to do so is shown below:
bool isRowSelector = false; private void ultraGrid1_Click(object sender, EventArgs e) { if (isRowSelector) { //Do what you have to do here } } private void ultraGrid1_MouseEnterElement(object sender, Infragistics.Win.UIElementEventArgs e) { if (e.Element is RowSelectorUIElement) { isRowSelector = true; } } private void ultraGrid1_MouseLeaveElement(object sender, Infragistics.Win.UIElementEventArgs e) { if (isRowSelector) { isRowSelector = false; } }
Please feel free to let me know if there is anything else that I could assist you with.
Hi Rubie,
I don't know what you mean by "it is pointing me to old row". What property are you accessing?
I do have same problem, when I rightclick to rowselector, it is pointing me to old row, but I need right click feature on row selector too, how can I get current active row on right click of row selector.
Hello Tfresna,
Thank you for the feedback.
If you have any questions in the future please feel free to contact us.
I tried your solution and it works. I'm clearing the selected rows in the MouseDown event handler in case I'm right clicking a row selector.
Thanks.