c#字符串加载wpf控件模板代码 - 简书
2021-06-08 23:03
标签:tree soft -name memory tag encoding enc 字符串 nfx c#字符串加载wpf控件模板代码 - 简书 标签:tree soft -name memory tag encoding enc 字符串 nfx 原文地址:https://www.cnblogs.com/lonelyxmas/p/10682570.html 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 xamlButton>
DockPanel>