Instantly share code, notes, and snippets.

View tOnDataGridDoubleClickEvenRaiseEventForRow.ps1
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
}
View MakeSomethingCool.ps1
function Show-MessageBox {
param(
$Title = "The cool Dialog",
[Parameter(Mandatory=$true)]
$Message,
[System.Windows.Forms.MessageBoxIcon]$Icon = "Information",
[System.Windows.Forms.MessageBoxButtons]$Buttons = "Ok"
)
[System.Windows.Forms.MessageBox]::Show($Message, $Title, $Buttons, $Icon) | Out-Null
}