Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatrickGrub/94841e76b4ba45beb28a4fab94c29120 to your computer and use it in GitHub Desktop.
Save PatrickGrub/94841e76b4ba45beb28a4fab94c29120 to your computer and use it in GitHub Desktop.
Hook to DataGrid DoubleClickEvent and receive Information about the row
function Add-DataGridDoubleClickEventOnRow {
param(
[System.Windows.Controls.DataGrid]$DatagridControl,
[System.Windows.Input.MouseButtonEventHandler]$ScriptBlock
)
$rowStyle = New-Object System.Windows.Style -ArgumentList @([System.Windows.Controls.DataGridRow])
$eventSetter = New-Object System.Windows.EventSetter -ArgumentList @([System.Windows.Controls.DataGridRow]::MouseDoubleClickEvent, $scriptBlock)
$rowStyle.Setters.Add($eventSetter)
$datagridControl.RowStyle = $rowStyle
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment