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>
原文地址:https://www.cnblogs.com/lonelyxmas/p/10682570.html
时间: 2024-10-10 02:52:57