美文网首页
【WPF】在窗口加载xaml文件显示

【WPF】在窗口加载xaml文件显示

作者: UnicornChen | 来源:发表于2019-08-27 11:08 被阅读0次

 //从外部文件中加载 Button控件

        public void LoadEmbeddedXaml2()

        {

            XmlTextReader xmlreader = new XmlTextReader("d:\\a.xaml");

            UIElement obj = XamlReader.Load(xmlreader) as UIElement;

            grid1.Children.Add((UIElement)obj);

        }

相关文章

网友评论

      本文标题:【WPF】在窗口加载xaml文件显示

      本文链接:https://www.haomeiwen.com/subject/wuwsectx.html