为什么我的 XAML 编辑器会给我一个错误,但项目编译并运行良好? [英] Why would my XAML editor be giving me an error but the project compiles and runs fine?

查看:33
本文介绍了为什么我的 XAML 编辑器会给我一个错误,但项目编译并运行良好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实施了附加行为命令模式 编译并运行良好,但奇怪的是我的 XAML 编辑器给出了错误:

I've implemented the Attached Behavior Command pattern which compiles and runs fine, but strangely my XAML editor is giving the error:

可附加属性行为"未在类型中找到'CommandBehaviorCollection'.

The attachable property 'Behaviors' was not found in type 'CommandBehaviorCollection'.

在此 XAML 中:

   <c:CommandBehaviorCollection.Behaviors>
        <c:BehaviorBinding Event="MouseLeftButtonDown" 
                           Command="{Binding PressedLeftButton}"
                           CommandParameter="MainBorder123"/>
        <c:BehaviorBinding Event="MouseRightButtonDown" 
                           Command="{Binding PressedRightButton}"
                           CommandParameter="MainBorder123"/>
    </c:CommandBehaviorCollection.Behaviors>

但是,我可以编译并运行它.

However, I can compile and run it fine.

我重建了项目、解决方案,关闭并打开它,但 XAML 编辑器仍然给我这个错误.

I've rebuilt the project, the solution, closed and opened it, but the XAML editor still gives me this error.

有没有人遇到过这样的XAML 编辑器和编译器之间的不一致?知道如何让 XAML 编辑器看到确实没有问题吗?

Has anyone experienced an incongruity between XAML editor and compiler like this before? Any idea how to make the XAML editor see that there really isn't a problem?

推荐答案

是的.我通常关闭 XAML 编辑器并改用 XML 编辑器.它更快,并且不会向您抛出这些红鲱鱼错误".我还没有机会尝试,但希望 VS2010 在这方面做得更好.

Yes. I normally turn the XAML Editor off and use the XML Editor instead. It's faster and doesn't throw these red herring "errors" at you. I haven't had a chance to try it yet, but hopefully VS2010 does a much better job in this area.

这篇关于为什么我的 XAML 编辑器会给我一个错误,但项目编译并运行良好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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