| 123456789101112131415161718192021222324 |
- #XAML Code kann zwischen @" und "@ ersetzt werden:
- [xml]$XAML = @"
- <Window x:Class="WpfApplication.MainWindow"
- 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:WpfApplication"
- mc:Ignorable="d"
- Title="MainWindow" Height="768" Width="1024">
- <StackPanel x:Name="StackPanel" Margin = "50,50,50,50">
- </StackPanel>
- </Window>
- "@ -replace 'mc:Ignorable="d"','' -replace "x:N",'N' -replace '^<Win.*', '<Window' #-replace wird benötigt, wenn XAML aus Visual Studio kopiert wird.
- Function TestWPF(){
- #XAML laden
- [void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
- [Windows.Markup.XamlReader]::Load( (New-Object System.Xml.XmlNodeReader $XAML) )
- }
|