StreamResourceInfo sri = Application.GetResourceStream(new Uri("HowTo;component/Page.xaml", UriKind.Relative));
             StreamReader sr
= new
StreamReader(sri.Stream);
             txtReadxml.Text
= sr.ReadToEnd();
{1};component/{2}
1为程序集的名字
2为想读取的页面

page.xaml:

<UserControl x:Class="HowTo.Page"
     xmlns
="http://schemas.microsoft.com/client/2007"
     xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml"

     Width
="400" Height="300">

    
<Grid x:Name="LayoutRoot" Background="White">
        
<TextBlock x:Name="txtReadxml"></TextBlock>
    
</Grid>
</UserControl>

(转)Silverlight从程序集读取xaml文件

相关文章:

  • 2021-08-12
  • 2022-12-23
  • 2022-12-23
  • 2021-07-15
  • 2021-08-02
  • 2022-12-23
  • 2021-09-27
  • 2021-06-14
猜你喜欢
  • 2021-07-16
  • 2021-10-30
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2021-10-13
  • 2021-08-17
相关资源
相似解决方案