获取“名称xxx在名称空间xxx中不存在”仅在Blend中(在VS2008中很好) [英] Getting "The name xxx does not exist in the namespace xxx" only in Blend (fine in VS2008)

查看:72
本文介绍了获取“名称xxx在名称空间xxx中不存在”仅在Blend中(在VS2008中很好)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在尝试使用Blend 3.0来编辑包含一些WPF控件的项目。这个项目已经从Visual Studio 2008编译并运行良好。


然而,在Blend中,我遇到了一些没有意义的神秘错误:


For例如,我有一个派生自Control的类:



 namespace Company.WPFControls.SearchTextBox 
{
public class SearchTextBox :控制
{
...
}
}



我试着在资源中,在同一个程序集中使用它来分配样式:



< ResourceDictionary 
xmlns =" http: //schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x =" http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d =" http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc =" http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local =" clr-namespace:Company.WPFControls.SearchTextBox"

< Style TargetType =" {x:Type local:SearchTextBox}">
...
< / Style>
< / ResourceDictionary>




我在Blend中收到以下错误:



名称"SearchTextBox"命名空间中没有"clr-namespace:Company.WPFControls.SearchTextBox"。



我已经尝试指定程序集名称,通过添加; assembly = Company.WPFControls 但它不会删除错误。


有没有办法解决这个问题或者在至少找出问题的来源?

解决方案

您是否右键单击了使用SearchTextBox的项目并添加了对SearchTextBox项目的引用?

I am trying to use Blend 3.0 to edit a project that contains some WPF controls. This project already compiles and runs fine from Visual Studio 2008.

In Blend however, I'm getting mysterious errors that make no sense:

For example, I have a class that derives from Control :

    namespace Company.WPFControls.SearchTextBox
    {
        public class SearchTextBox : Control
        {
            ...
        }
    }

And I try to use it in a resource, in the same assembly, to assign a style:

    <ResourceDictionary
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Company.WPFControls.SearchTextBox"
   
        <Style TargetType="{x:Type local:SearchTextBox}">
            ...
        </Style>
    </ResourceDictionary>


I get the following error in Blend:

The name "SearchTextBox" does not exist in the namespace "clr-namespace:Company.WPFControls.SearchTextBox".

I've tried specifying the assembly name, by adding ;assembly=Company.WPFControls but it doesn't remove the error.

Is there any way to fix this or at least figure out where the problem comes from?

解决方案

Did you right click on the project that uses the SearchTextBox and add a reference to the SearchTextBox project?


这篇关于获取“名称xxx在名称空间xxx中不存在”仅在Blend中(在VS2008中很好)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆