Created
July 10, 2018 11:42
-
-
Save PatrickGrub/94841e76b4ba45beb28a4fab94c29120 to your computer and use it in GitHub Desktop.
Hook to DataGrid DoubleClickEvent and receive Information about the row
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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