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

Tagged:

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?


Edward TanguayH
2009-05-29 15:31:56 Scores:0

1 answer

Answer 1
Scores:0

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.

Kent Boogaart H
2009-05-29 15:42:14
How do you "turn it off", I don't see it under tools | options | text editors | xaml for instance.
Edward Tanguay H
2009-05-29 16:00:24 Scores:0
You need to map the .xaml extension to the XML editor. It's in the options somewhere under File Extensions.
Kent Boogaart H
2009-05-29 17:29:21 Scores:0
Share |
View original post at stackoverflow.com

Related topics

wasn't there a way to generate an event handler from the XAML editor in a silverlight project

Not wanting to enter into the debate of wiring up event handlers in code or in XAML, sufice it to say, that I seem to recall there was a kind of "tab to create" feature in the XAML editor for silverlight projects. Clearly it's been a while since I ...

Why does my converter giving an invalid cast error?

I created a Converter to convert from double to integer. But the line "return (int)value;" always gets a "specified cast is not valid." What do I have to do so that my Converter successfully converts a double and sends back an integer? Converter: namespace TestChangeAngle { [ValueConversion(typeof(double), typeof(int))] class ...

My application won't launch giving me some random error error when I haven't touched anything

I'm having trouble debugging my application because I can't even run it. I haven't changed anything only added a picture to a folder in my solution explorer and now I can't even press F5 to debug it. Here's the error: System.Windows.Markup.XamlParseException was unhandled Message=" Can't create instance of 'MainWindow' ...

Help with error: The file 'MainWindow.xaml' is not part of the project or its 'Build Action' property is not set to 'Resource'

Oddly enough, googling this error doesn't produce any results. Is there any quick fix for this bug / known causes? The file's build action is Page like the rest of my xaml windows, and it is definitely part of the project. ...

Giving a WPF treview to do Richtext (Xaml) displaying and editing and drag drop

To give the ability to display and edit Richtext (Xaml) inside a treeview item,I have used a bindable Richtextbox (custom user control that used a richtextbox) to the HierachicalDataTemplate that used to populate the TreeViewItems. This works fine but at the same time I want to have the drag and ...

XAML build error on VB.NET project with controls from external DLL

I'm trying to migrate a WPF Application based on C# to identical project but based writed in VB.NET. I have some problem with XAML Window. The Window have some reference from external dll controls. For example: <Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:menus="clr-namespace:My.Frame.UI.WPF;assembly=My.Frame.UI.WPF.Menus"> ...

Can't use WPF designer because can't find custom base window type in XAML, but code behind is fine

I am using a base Window class in a WPF project. In the code behind C# file the assembly to the base type is referenced and fine. In the XAML is looks like this: <MyNamespace:WindowBase x:Class="MyNamespace.Applications.UserInterface.MainWindow" ...

Error when trying to create unit tests for wpf-project

when i try to create unit tests using the unit test wizzard in visual studio 2008 the following error message is shown: "The following error was encountered while reading module 'PresentationFramework': Could not resolve member reference: System.Windows.Automation.Provider.IToggleProvider::get_ToggleState" I am able to create unit tests for all prjects that do not reference the ...

WPF View is giving Error

<Page x:Class="Project.ProjectDiagramView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:s="clr-namespace:DiagramDesigner" xmlns:c="clr-namespace:DiagramDesigner.Controls" mc:Ignorable="d" ...

Setting design time DataContext on a Window is giving a compiler error?

I have the following XAML below for the main window in my WPF application, I am trying to set the design time d:DataContext below, which I can successfully do for all my various UserControls, but it gives me this error when I try to do it on the window... Error ...