Hi all,
is there a way, to make a full row selction in the DataGrid ?
THX
NETY
Printable View
Hi all,
is there a way, to make a full row selction in the DataGrid ?
THX
NETY
use myDatagrid.Select(RowIndex) to mark the whole row in the CurrentCellChanged-Event
for example:
Private Sub dgBenutzer_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgBenutzer.CurrentCellChanged
Try
' Row markieren
dgBenutzer.Select(dgBenutzer.CurrentRowIndex)
Catch ex As Exception
objError.raiseSysError(Me.Name, "dgBenutzer", "CurrentCellChanged", ex.Message, "")
End Try
End Sub
Hi escape0,
THX for the Tip, he works fine!
When I now click in a cell, the Row was selected, but the Cell fells like an Editor Cell. How can i disable this? ( The ReadOnly Property is set to True)
Greetings
NETY
i know... i had the same problem
i have a column which is not shown (width=0) in the grid.
Private Sub dgBenutzer_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgBenutzer.CurrentCellChanged
Try
' Focus in Spalte 0 (nicht sichtbar) setzen
Dim dgCell As DataGridCell
dgCell.ColumnNumber = 0
dgCell.RowNumber = dgBenutzer.CurrentRowIndex
dgBenutzer.CurrentCell = dgCell
' Row markieren
dgBenutzer.Select(dgBenutzer.CurrentRowIndex)
Catch ex As Exception
objError.raiseSysError(Me.Name, "dgBenutzer", "CurrentCellChanged", ex.Message, "")
End Try
End Sub
when the user clicks in a cell the currentcell is changed to the first column of the clicked row - this column is not visible in the grid.
maybe there's an other way to do this but i couldn't get any information concerning this.
bye
robert
Hi escape0,
thanks for your try.
For some minutes I´ve got an E-Mail, how to make it:
1. Add the following Line of Code after the 'InitializeComponent()call' :
AddHandler DataGrid1.MouseUp, AddressOf highLightRow
2.
Private Sub highLightRow(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim pt = New Point(e.X, e.Y)
Dim grd As DataGrid = CType(sender, DataGrid)
Dim hit As DataGrid.HitTestInfo = grd.HitTest(pt)
If hit.Type = grd.HitTestType.Cell Then
grd.CurrentCell = New DataGridCell(hit.Row, hit.Column)
grd.Select(hit.Row)
End If
End Sub
That´s it.
Greetings
NETY