我正在学习MVVM教程,我有以下代码,用Xaml编写:
<Window x:Class="WPFMVVM.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WPFMVVM; assembly=WPFMVVM" Title="MainWindow" Height="388" Width="545">
xmlns:local行抱怨说没有引用WPFMVVM程序集.虽然这是我正在组装的组件.
谁知道为什么?
谢谢
解决方法
你不能在那里有空位.如果它是你工作的程序集只是不指定程序集.
xmlns:local="clr-namespace:WPFMVVM"
程序集参数用于引用的程序集.另见MSDN article on XAML namespaces.
assembly can be omitted if the clr-namespace referenced is being defined within the same assembly as the application code that is referencing the custom classes. Or,an equivalent Syntax for this case is to specify assembly=,with no string token following the equals sign.