Hi Sir, how can i add an external resource dictionary to a wpf powershell code.
code#######################################################################
Clear-host
Add-Type -AssemblyName PresentationCore,PresentationFramework,WindowsBase,system.windows.forms
[xml] $xaml = @"
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="Frm_WPF" WindowStartupLocation = "CenterScreen"
Height="503.731" Width="687.687" ShowInTaskbar = "True" WindowStyle = "ToolWindow">
<Window.Resources>
<ResourceDictionary Source="D:/PowerShell Script/NAVIGATION PANE/sample.xaml" />
</Window.Resources>
</Window>
"@
$reader=(New-Object System.Xml.XmlNodeReader $xaml)
$Frm_WPF=[Windows.Markup.XamlReader]::Load( $reader )
#$Frm_WPF.ShowDialog()
code#######################################################################
error#######################################################################
Exception calling "Load" with "1" argument(s): "'D:/PowerShell Script/NAVIGATION PANE/sample.xaml' value cannot be assigned to property 'Source' of object 'System
.Windows.ResourceDictionary'. The tag 'Window.Resources' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'. Line '1' Pos
ition '2'. Error at object 'System.Windows.ResourceDictionary'."
At D:\PowerShell Script\NAVIGATION PANE\dummy1.ps1:19 char:43
+ $Frm_WPF=[Windows.Markup.XamlReader]::Load <<<< ( $reader )
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
error######################################################################