码迷,mamicode.com
首页 > Windows程序 > 详细

c#字符串加载wpf控件模板代码 - 简书

时间:2019-04-10 13:18:14      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:tree   soft   -name   memory   tag   encoding   enc   字符串   nfx   

原文:c#字符串加载wpf控件模板代码 - 简书

    ResourceManager resManagerA = new ResourceManager("cn.qssq666.Properties.Resources", typeof(cn.ijiami.keyboard.Properties.Resources).Assembly);
            string astring = resManagerA.GetString("axml_test");
            LogUtil.writeLog("xaml字符串 "+astring);
            MemoryStream stream = new MemoryStream(System.Text.Encoding.Default.GetBytes(astring));
            DependencyObject element =(DependencyObject) XamlReader.Load(stream);
             Button buttonXaml=      LogicalTreeHelper.FindLogicalNode(element, "button1") as Button;
            DockPanel dockPanel = LogicalTreeHelper.FindLogicalNode(element, "dock_panel") as DockPanel;
<DockPanel
    Name="dock_panel"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        >
    <Button Name="button1" Margin="300" Background="#FFD49923">
        <Button.Effect>
            <DropShadowEffect Color="#FFFF0B0B"/>
        </Button.Effect> Hello xaml</Button>
</DockPanel>

c#字符串加载wpf控件模板代码 - 简书

标签:tree   soft   -name   memory   tag   encoding   enc   字符串   nfx   

原文地址:https://www.cnblogs.com/lonelyxmas/p/10682570.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!