打印

sl从程序集中读取xaml文件

复制内容到剪贴板
代码:
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>


[ 本帖最后由 nasawz 于 2008-4-9 01:48 编辑 ]
玩闹的时间过去了。

blog:http://nasa.cnblogs.com
msn:nasa_wz@hotmail.com
QQ:12446006

TOP