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>
这种方法不仅可以读取xaml. 只要是以嵌入资源的形式放在项目中都可以获取.
作者:nasa
联系:nasa_wz@hotmail.com
QQ:12446006
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有