sl从程序集中读取xaml文件
[code]StreamResourceInfo sri = Application.GetResourceStream(new Uri("HowTo;component/Page.xaml", UriKind.Relative));
StreamReader sr = new StreamReader(sri.Stream);
txtReadxml.Text = sr.ReadToEnd();[/code]
{1};component/{2}
1为程序集的名字
2为想读取的页面
page.xaml:
[code]
<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>[/code]
[img]http://www.cnblogs.com/images/cnblogs_com/nasa/silverlight/2008-04-09_004823.jpg[/img]
[[i] 本帖最后由 nasawz 于 2008-4-9 01:48 编辑 [/i]]
页:
[1]