2013-09-30 21 views
0

我创建了一个WPF窗口是这样的:域名错误出现两次

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="clr-namespace:ReVVed" x:Class="ReVVed.Merge_Text_Window" 
    MinWidth="400" MinHeight="400" Width="600" Height="400" WindowStyle="ToolWindow" Title="Merge Text" WindowStartupLocation="CenterOwner" Loaded="Window_Loaded"> 

我编译的代码,并尝试了,但是当我回去,并增加了一个Window_Loaded事件处理程序,我开始收到此错误:

The type name 'Merge_Text_Window' does not exist in the type 'ReVVed.ReVVed'

我不知道在看什么ReVVed.ReVVed。错误引用第4行第22列是Minwidth声明。我的代码中的任何地方都没有ReVVed.ReVVed命名空间。我无法编译。

任何想法?

回答

0

不知道为什么它的工作原理,但我把窗和后面的代码到一个单独的命名空间,而不是根据项目的命名空间,它现在编译罚款。

0

您是否尝试过这种方式,因为在类重复已经指定的本地名称空间之前,消息意味着名称空间?

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="clr-namespace:ReVVed" x:Class="Merge_Text_Window" 
    MinWidth="400" MinHeight="400" Width="600" Height="400" WindowStyle="ToolWindow" Title="Merge Text" WindowStartupLocation="CenterOwner" Loaded="Window_Loaded"> 
+0

是的,如果我在类声明中省略了名称空间,则代码中的所有函数和变量“不存在于当前上下文中”。 –