zoukankan      html  css  js  c++  java
  • (转)Silverlight从程序集读取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>


  • 相关阅读:
    牛客练习赛24 E:青蛙(最短路)
    菜根谭#10
    菜根谭#9
    菜根谭#8
    菜根谭#7
    菜根谭#6
    菜根谭#5
    菜根谭#4
    菜根谭#3
    菜根谭#2
  • 原文地址:https://www.cnblogs.com/timy/p/1987346.html
Copyright © 2011-2022 走看看