Is it possible to select/deselect a row in ultragrid by single mouse click like listbox control in winforms?
Example:
1st click on a row should select(highlight) the entire row.
2nd click on the same row should deselect the entire row.
Select is working when mouse is clicked on Row header in ultragrid and Deselect is working when CTRL + mouse click is done.
But i want the select/deselect feature when clicking a row(not row header).
Thank you.
Hello Toji,
I attached another sample that uses a SelectionStrategyFilter which will work nicely with multiple rows selected and is more efficient for your requirement. Compared to my previous sample, deselecting one row won't affect the others.
For more details you can visit our dev center article here: (best viewed in Chrome)http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=8279
Let me know if you have any questions.
This one helped.
That's great! Your welcome.
The sample in "UltraWinGrid Extended Selection Strategy Filter.zip" helped me, but i see a problem in the example.
I cannot set focus onto a editable cell for editing the value.
There are datetime and color combos in the grid in the example, try to open the combo, it won't open.
This is the same case with other cell editing also.
The reason i see why the editable cell is going out of its edit state is because we do the manually selecting of the row by Selected property.
Prior to the selection change if we could store all the possible values which is going to get changed after the selection and resetting those values back will help, but Infragistics should help me get method for this, because i don't know what all properties i need to backup and restore.
Thank you
After thinking of this some more, the sample above was intenteded to do the following click a row to select and click once more again to deselect it. Which we both agree meets your requirements. However editing a cell is going to interfere with this because when do we tell whether or not to deleselect a row or enter edit mode? I'm not sure this is going to be achievable.
Could you please please clarify your requirements. Keep in mind by default our grid cannot have selected rows and a cell in editmode at the same time.
Let me know if you have any questions regarding this matter.
I am glad to hear you have a working solution. Have a nice day.
I actually have a grid which should have select/deselect option as well as editing(not every cells) capability.
I didn't ever thought the select/deselect will block the editing on grid.
Anyway i have already did a work around for this. If the cell is set for editing and if the user clicks the cell which has editing capability, then i won't do the select/deselect. Till now this code didn't break. :)
row = Me.GetRowFromPoint(uGrid, New Drawing.Point(e.X, e.Y), cell)
If cell IsNot Nothing Then
If Not cell.IsInEditMode Then cell.Row.Selected = Not cell.Row.Selected End If
ElseIf row IsNot Nothing Then
row.Selected = Not row.Selected
End If