1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
Add-Type -AssemblyName PresentationFramework $codigoxaml = @' <window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Title="Window with Button" Width="250" Height="100"> <!-- Add button to window --> <button Name="button">Pulsar al botón</button> </window> '@ $cargar = [System.XML.XMLReader]::Create([System.IO.StringReader]$codigoxaml) $ventana = [System.Windows.Markup.XAMLReader]::Load($cargar) $boton = $ventana.FindName("button") $boton.Add_Click({ Write-Host "Botón pulsado" }) $ventana.ShowDialog() |