I've downloaded this AttachedCommandProject and ran it and it works well, enables me to e.g. put a MouseDown command on a Border element and handle that with a command in my ViewModel.
Now I would like to add this AttachedCommand functionality to my MVVM Visual Studio Template.
I copied all the necessary files into the my Commands folder of the MVVM project:
13.12.2008 21:00 7.445 BehaviorBinding.cs
05.12.2008 17:50 7.477 CommandBehavior.cs
13.12.2008 21:01 3.908 CommandBehaviorBinding.cs
13.12.2008 21:06 5.097 CommandBehaviorCollection.cs
04.12.2008 21:48 3.564 EventHandlerGenerator.cs
05.12.2008 17:52 2.376 ExecutionStrategy.cs
05.12.2008 17:52 2.067 SimpleCommand.cs
But when I try to use it with the same syntax as in the original project, I get the error The property 'CommandBehavior.Event' does not exist in XML namespace 'clr-namespace:MvvmWithAttachedBehaviors.Commands'..
There are no other files to copy and no other references to add as far as I can see.
What could this error be trying to tell me? Has anyone gotten this AttachedCommandBehavior functionality to work in other projects?
<Window x:Class="MvvmWithAttachedBehaviors.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:MvvmWithAttachedBehaviors.Commands"
Title="Main Window" Height="400" Width="800">
<DockPanel>
<StackPanel>
<TextBlock Text="{Binding Output}"/>
<Border Background="Yellow" Width="350" Margin="0,0,10,0" Height="35" CornerRadius="2"
c:CommandBehavior.Event="MouseDown"
c:CommandBehavior.Command="{Binding SomeCommand}"
c:CommandBehavior.CommandParameter="This is the parameter sent."
>
<TextBlock Text="MouseDown on this border to execute the command"/>
</Border>
</StackPanel>
</DockPanel>
</Window>