I have a DataGrid in where I have code in the MouseUp Event that checks
the area of the Grid clicked, and highlights the entire row. Problem
is, that if you the "Right-Click" on another row, it highlights that
row and any subsequent rows using the "Right-Click". In essence, the
Right-Click of a mouse is inadvertently turning my Grid into a
Multi-Select, which I do not want.
I thought about finding a way to disable Right-Clicking in general on
the Grid, but that is not a option because I plan on adding a Context
menu.
I want to know if there is a way, I assume via code, to tell the grid
that on a Right-Click, it should highlight ONLY the row clicked, not in
addition to other rows.
For reference, I am pasting my current click to highlight entire row
code located in my Grid's MouseUp Event:
'***************************************
' Initialize Variables
'***************************************
Dim ptMouseLocation = New Point(e.X, e.Y)
Dim hitDataGridClickArea As DataGrid.HitTestInfo =
gridTickets.HitTest(ptMouseLocation)
Dim objDataSet As DataSet
'***************************************
' Process Mouse Click Information
'***************************************
If hitDataGridClickArea.Type = Windows.Forms.DataGrid.HitTestType.Cell
Then
'***************************************
' Set Current Cell & Highlight The Row
'***************************************
gridTickets.CurrentCell = New
DataGridCell(hitDataGridClickArea.Row, hitDataGridClickArea.Column)
gridTickets.Select(hitDataGridClickArea.Row)
End If