XamlReader.Load 问题~
Stream stream = Application.GetResourceStream( new StreamResourceInfo(packageStream, null), new Uri("AppManifest.xaml", UriKind.Relative)).Stream; String appManifestString = new StreamReader(stream).ReadToEnd();[color=#FF0000] Deployment deployment = (Deployment)XamlReader.Load(appManifestString);[/color]
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" EntryPointAssembly="Silverlightest_welcome" EntryPointType="Silverlightest_welcome.App" RuntimeVersion="2.0.31005.0"> <Deployment.Parts> <AssemblyPart x:Name="Silverlightest_welcome" urce="Silverlightest_welcome.dll" /> </Deployment.Parts> </Deployment>
string str = @"<UserControl xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' xmlns:y='http://schemas.microsoft.com/client/2007/deployment'><UserControl.Resources><y:Deployment x:Key='manifest' EntryPointAssembly='Silverlightest_welcome' EntryPointType='Silverlightest_welcome.App' RuntimeVersion='2.0.31005.0'> <y:Deployment.Parts> <y:AssemblyPart x:Name='Silverlightest_welcome' Source='Silverlightest_welcome.dll' /> </y:Deployment.Parts> </y:Deployment></UserControl.Resources></UserControl>"; FrameworkElement obj = System.Windows.Markup.XamlReader.Load(str) as FrameworkElement; Deployment d = obj.Resources["manifest"] as Deployment;