Skip to content

Instantly share code, notes, and snippets.

@SteveL-MSFT
Created September 17, 2019 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SteveL-MSFT/7aa29a32cc6a3496cafb81bd79371240 to your computer and use it in GitHub Desktop.
Save SteveL-MSFT/7aa29a32cc6a3496cafb81bd79371240 to your computer and use it in GitHub Desktop.
WPF Example
add-type -AssemblyName presentationframework
$xaml = @"
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="Window" Title="Initial Window" WindowStartupLocation = "CenterScreen"
Width = "400" Height = "300" ShowInTaskbar = "True">
</Window>
"@
$stream=[System.IO.MemoryStream]::new([System.Text.Encoding]::Unicode.GetBytes($xaml))
$reader=[System.Xml.XmlReader]::Create($stream)
$Window=[System.Windows.Markup.XamlReader]::Load($reader)
$Window.Show()
Start-Sleep -Seconds 5
$Window.Close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment