本文共 512 字,大约阅读时间需要 1 分钟。
XAML:
CS:
using (FileStream s = new FileStream(@"C:\Users\Lin.net\Desktop\WpfApplication1\Xaml\Test.xaml", FileMode.Open)) { Grid grid = XamlReader.Load(s) as Grid; Window win = new Window1(); win.Content = grid; win.ShowDialog(); }
注意:
xmlns:x="http://schemas.microsoft.com/client/2006" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"以上两个命名空间必须加入到XAML中间(WPF).Silverlight的命名空间有点区别.
转载地址:http://txkix.baihongyu.com/