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}StreamReader sr = new StreamReader(sri.Stream);
txtReadxml.Text = sr.ReadToEnd();
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>
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>
![](http://hiphotos.baidu.com/%C4%AB%C1%E9%D2%C1%C8%BB/pic/item/48a4c336e37345fea2cc2bc9.jpg)