Edward Tanguay
Edward Tanguay

Reputation: 193322

Why would my XAML editor be giving me an error but the project compiles and runs fine?

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

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

in this 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.

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

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?

Upvotes: 0

Views: 709

Answers (1)

Kent Boogaart
Kent Boogaart

Reputation: 178700

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.

Upvotes: 1

Related Questions