Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- XAML GUI Template
- #>
- Add-Type -AssemblyName PresentationFramework
- Add-Type -AssemblyName System.Windows.Forms
- [xml]$XAML = @"
- <-- PASTE VISUAL STUDIO XML CODE HERE -->
- "@
- $XAML.Window.RemoveAttribute('x:Class')
- $XAML.Window.RemoveAttribute('mc:Ignorable')
- $XAMLReader = New-Object System.Xml.XmlNodeReader $XAML
- $MainWindow = [Windows.Markup.XamlReader]::Load($XAMLReader)
- $namenodes = $XAML.SelectNodes("//*[@*[contains(translate(name(.),'n','N'),'Name')]]")
- $wpf =@{}
- $namenodes | ForEach-Object{$wpf.add($_.Name,$MainWindow.FindName($_.Name))}
- #$wpf.Button.Add_Click({
- # Write-Host "Hello World"
- #})
- $MainWindow.ShowDialog() | Out-Null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement