1. 程式人生 > >c#字符串加載wpf控件模板代碼 - 簡書

c#字符串加載wpf控件模板代碼 - 簡書

per .get eof prope nco sch source name get

原文: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控件模板代碼 - 簡書