VS新建一个WPF项目;默认基本代码如下;
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
</Grid>
</Window>
wpf命名空间的语法:xmlns:[可选映射前缀]=“命名空间描述”
没有加可选映射前缀的xmlns是WPF默认的命名空间;
一个完整的xaml文件,必须具备两个命名空间(xmlns命名空间和xmlns:x命名空间必须要有);
加入这两行,
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
"http://schemas.microsoft.com/winfx/2006/xaml"
将会在工程中引入如下的dll;后面标有红线的几个;