Skip to content

Instantly share code, notes, and snippets.

Created January 25, 2017 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/f0a3d1f773a3549eec0567735334ca9b to your computer and use it in GitHub Desktop.
Save anonymous/f0a3d1f773a3549eec0567735334ca9b to your computer and use it in GitHub Desktop.
Add-Type -AssemblyName PresentationFramework
Add-Type -AssemblyName System.Windows.Forms
# WPF GUI Windows
$inputXAML = @"
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:GUI_test"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" x:Class="GUI_test.MainWindow"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<xctk:DateTimePicker HorizontalAlignment="Left" Height="32" Margin="115,122,0,0" VerticalAlignment="Top" Width="282"/>
</Grid>
</Window>
"@
[xml]$Form = $inputXAML -replace 'mc:Ignorable="d"','' -replace "x:N",'N' -replace '^<Win.*', '<Window'
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$Win=[Windows.Markup.XamlReader]::Load($NR)
$Win.showdialog()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment