Last active
August 30, 2015 14:00
-
-
Save fukuroder/afcacdaa48c8cedf56dd to your computer and use it in GitHub Desktop.
XAML in Windows PowerShell
This file contains hidden or 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
| Add-Type -AssemblyName presentationframework | |
| [xml]$xaml = @' | |
| <Window | |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
| Title="MainWindow" Height="100" Width="200" ResizeMode="NoResize"> | |
| <Grid> | |
| <Button Name="button1" Content="XAML"/> | |
| </Grid> | |
| </Window> | |
| '@ | |
| $reader=(New-Object System.Xml.XmlNodeReader $xaml) | |
| $window=[Windows.Markup.XamlReader]::Load( $reader ) | |
| $button = $window.FindName("button1") | |
| $button.add_Click({ $window.Close() }) | |
| $window.ShowDialog() | out-null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment