AttachedCommandBehavior V2 aka ACB
YOUAfter publishing my AttachedCommandBehavior library, (you can read about this here), some WPF Disciples recommended some new features to make the library cover more use cases. Thanks William Kempf your input was amazing!
I added 2 new features
- Support for Collection of binding to commands
- Support for Light weight Commands or as I call them Action
Support for Collection of binding to commands
This is a very handy feature. Let’s say you want to hook a command to the MouseDown but also want to hook up to the MouseEnter event, in ACB v1 you could now do this because you could only Bind one command at a time. Now the ACB v2 is supporting a collection of what I call BehaviorBinding. This is really powerful because it enables you to hook up to N number of events. The code would look something like this
1: <Border Background="Yellow" Width="350" Margin="0,0,10,0" Height="35" CornerRadius="2" x:Name="test">
2: <local:CommandBehaviorCollection.Behaviors>
3: <local:BehaviorBinding Event="MouseLeftButtonDown" Action="{Binding DoSomething}" CommandParameter="An Action on MouseLeftButtonDown"/>
4: <local:BehaviorBinding Event="MouseRightButtonDown" Command="{Binding SomeCommand}" CommandParameter="A Command on MouseRightButtonDown"/>
5: </local:CommandBehaviorCollection.Behaviors>
6: <TextBlock Text="MouseDown on this border to execute the command"/>
7: </Border>
So basically there is a read-only attached property Behaviors (which by the way it is something really cool, have a look at this post to find out more) and here you can define as many BehaviorBindings as you wish. I really love this part because I had to do some WPF tricks like the Freezable trick to make DataBinding work even in the Behaviors collections.
Support for Light weight Commands or as I call them Action
This is something really cool as well. Me and the Disciples were discussing how this could be a way to work around the fact that you cannot have a command handler in the XAML pointing to a method in the ViewModel, then William Kempf said
“Commands imply, to
me at least, CanExecute functionality. Once we extend this idea to
embrace multiple events, CanExecute functionality starts to become a
little murky, at best. Without CanExecute, you may just as well be
dealing with a delegate instead of an ICommand.”
So I decided to add support for this. Basically this feature enables you to expose a Delegate (of type Action<object> ) as a property in the ViewModel which would be called when the specified event is raised. Something like this
1: <Border Background="DarkSalmon" Width="350" Margin="0,0,10,0" Height="35" CornerRadius="2"
2: local:CommandBehavior.Event="MouseDown"
3: local:CommandBehavior.Action="{Binding DoSomething}"
4: local:CommandBehavior.CommandParameter="from the DarkSalmon Border"/>
and the ViewModel property would look like this
1: DoSomething = x => Messages.Add("Action executed: " + x.ToString());
As you can see in the example you can still use the CommandParameter attached property and it will be passed to you when the delegate is called.
Conclusion
I think that these 2 features add a lot to the ACB. I quite happy with what I achieved here and I hope that this library will also help you. Any feedback comments bug reports are most welcome
WARNING: This code was not tested a lot so expect bugs etc… If you want to use this in production code you are doing so at your own risk
yet I must say it works on my machine …. hehe





Cool dude
– This can be VERY useful – ACB is much more muscular now!!
[...] Marlon Grech on AttachedCommandBehavior V2 aka ACB [...]
Pingback by 2008 December 15 - Links for today « My (almost) Daily Links | December 16, 2008 |
I’m wondering if there’s a way to get the control to disable or enable when using either an action or command binding?
In the sample there is a SimpleCommand “ClearMessagesCommand” that is bound to a button the “usual” way:
But I would like to be able to bind the command to other events on the button like MouseDown / MouseOver etc. AND have the control disable.
Is there a way to extract the “CanExecute” return value like this:
<Button IsEnabled=”{Binding
ClearMessagesCommand.CanExecute}”
Next version of ACB will have a lot of these things
just give me some time
[...] my purposes. I must credit Mike Hillberg and his MethodCommand solution and Marlon Grech and his Attached Command Behaviors solution for guidance and inspiration as I waded into [...]
Pingback by MethodCaller: Invoking Methods betwen the View and the ViewModel « My Development KB | February 14, 2009 |
[...] 2 http://groups.google.com/group/wpf-disciples/browse_thread/thread/63cbe8b2b0575e4e?pli=1 3: http://marlongrech.wordpress.com/2008/12/13/attachedcommandbehavior-v2-aka-acb/ a smart way to use double click [...]
Pingback by attached property « Steveluo’s Blog | February 24, 2009 |
[...] some time and build a WPF sample application to showcase the use of MVVM + Mediator and also how AttachedCommandBehaviours can be used to further reduce (or better eliminate) C# code in XAML code behind files. I am also [...]
Pingback by [MVVM + Mediator + ACB = cool WPF App] – Intro « C# Disciples | April 2, 2009 |
Hi Marlon,
I recently study your ACB.
it is a very good idea.
and it also my problems.
but,…
I found a case fails ACB.
it is about routed command and foucs.
I use ACB on a border and assign a command react on boder’s MouseDown event.
If the focus is not on the view of this border, the command can not route to it’s view, but can route to it’s parent view.
Do you have any idea about this issue, thank you.
I didn’t quite understand … can you re explain please
Hi Marlon
There is a sample code for my issue,
http://caa.myweb.hinet.net\MyACBSample.zip
There are only one window and one view in this project,and
this view only contains one button and one border.
If the focus not on viewButton,
“Mouse Down” on border1 can not execute command.
but after click viewButton, it works(pop a message).
I also try to listen MouseDown event of border1 and execute command in the event handler in code behind, it works too.
I don`t realize why ACB Command could not work in this case.
Thanks for your comment, and this is a much useful method.
I don’t think this has anything to do with ACB it just how the routed events work…
Try using PreviewMouseDown. I think that would work for you.
P.S couldn’t download the file you sent… was saying Error 404
[...] http://marlongrech.wordpress.com/2008/12/13/attachedcommandbehavior-v2-aka-acb/ [...]
Pingback by [WPF] Comment actionner une commande WPF lorsqu’un évènement est déclenché ? , Thomas Lebrun | April 14, 2009 |
Great solution, but if Event that i need to route send for me EventArgs?
Can i bind event “EventArgs” to CommandParameter? And how can i do that?
not with the current implementation… sorry
Well, maybe you give me some tricks for modify EventHandlerGenerator.CreateDelegate method to support CommandBehaviorBinding.Execute with parameters? I’m not full understand ILGeneration there, but you are read all parameters from eventHandlerInfo, so may be this parameters can be binded to some parameters in Execute method?
For example:
public void Execute(object parameter)
{
if(CommandParameter == null)
{
strategy.Execute(parameter);
}
else
{
strategy.Execute(CommandParameter);
}
}
where “object parameter” is event EventArgs…
I’ll have to look into this…. because it is not that easy….
Thanks! This will be great, if it possible
[...] should state that this post was inspired by a good friend of mine Marlon Grechs AttachedCommandBehavior V2 aka ACB blog post. I loved and have used Marlons idea, but he uses dynamically created IL, to create the [...]
Pingback by sachabarber.net » WPF : Attached Commands | May 2, 2009 |
Damn, yeah! I’m merge ACB V2 and info from sachabarber.net, and this is it! Now i can bind command parameter, or hook EventArg’s! Thnx so much!
What i’m change:
1) Delete EventHandlerGenerator class.
2) Delete CommandBehaviorBinding.Execute method.
3) Update CommandBehaviorBinding.BindEvent method to this:
public void BindEvent(DependencyObject owner, string eventName)
{
EventName = eventName;
Owner = owner;
Event = Owner.GetType().GetEvent(EventName, BindingFlags.Public | BindingFlags.Instance);
if (Event == null)
throw new InvalidOperationException(String.Format(“Could not resolve event name {0}”, EventName));
//Register the handler to the Event
EventHandler = Delegate.CreateDelegate(Event.EventHandlerType, this,
GetType().GetMethod(“OnEventRaised”,
BindingFlags.NonPublic |
BindingFlags.Instance));
Event.AddEventHandler(Owner, EventHandler);
}
4) Add OnEventRaised method to CommandBehaviorBinding class:
///
/// Runs the ICommand when the requested RoutedEvent fires
///
private void OnEventRaised(object sender, EventArgs e)
{
if (Command != null)
{
if(CommandParameter != null)
{
Command.Execute(CommandParameter);
}
else
{
Command.Execute(e);
}
}
}
5) Enjoy and have fun
In this example your are not executing the strategy. You will then miss out the check for CanExecute.
it is really greate!!
I saw your idea and clever implementation of it.
Thank you~~ ^^
And little more… If we bind CommandParameter to some item. And on some event we need to take this item or null value? So, with this implementation we will take binded item, or event args… This method is little wrong
I resolve this problem like this:
1) In CommandBehaviorBinding replace CommandParameter property to this:
///
/// Gets or sets a CommandParameter
///
private object commandParameter;
public object CommandParameter
{
get
{
return commandParameter;
}
set
{
commandParameter = value;
IsCommandParameterBinded = true;
}
}
2) Add IsCommandParameterBinded property to CommandBehaviorBinding:
protected bool IsCommandParameterBinded { get; set; }
3) Update OnEventRaised method in CommandBehaviorBinding to this:
///
/// Runs the ICommand when the requested RoutedEvent fires
///
private void OnEventRaised(object sender, EventArgs e)
{
if (strategy != null)
{
if (IsCommandParameterBinded)
{
strategy.Execute(CommandParameter);
}
else
{
strategy.Execute(e);
}
}
}
So now, if we bind CommandParameter we will take only CommandParameter values. If not, we will hook EventArg’s. I’m not sure about replacing “Command” to “strategy” there, but I’m do that.
Marlon, may be you collect this changes to next version and fix our misunderstanding about Command and strategy in CommandBehaviorBinding?
[...] http://marlongrech.wordpress.com/2008/12/13/attachedcommandbehavior-v2-aka-acb/ [...]
Pingback by kevin Mocha - AttachedCommandBehavior V2 aka ACB | May 29, 2009 |
visit us!
newsbox.cc
newsbox.us
nbstatus.wordpress.com
NOW!
Hi, very very nice article. I love it since it helps me handling events and commands in a consistent manner. Thers only a question: Can I get rid of the Error in the XAML editor about the .Behaviours attached property that is not found on the type CommandBehaviorCollection? Thanks for your work, its GREAT!
Hi, very good article, I have used your sample for a mouseDown and get my commnad to be executed on the ViewModel. How do I get the mouse position to be passed to the ViewModel
TIA
Yaz
you can get the event args like this
http://marlongrech.wordpress.com/2009/07/03/how-to-get-the-eventargs-as-a-commandparameter-using-the-attachedcommandbehaviour/
Can anyone tell me how to use it in a Style?
Hi Marlongrech
I have been using your idea of ACB v1 to develop an attached behavior which is able to support hooking multiple event on a certain WPF control and now I have to deal with a strange issue which I don’t know why.
My source code was uploaded at
http://www.yousendit.com/download/Z01OTXRhbEoxUUJjR0E9PQ
The following xaml code is where the strange happening. The issue is I was only able to get one eventName “PreviewMouseDown” the last one in the following code.
But what i expect is the xamp parser should send to me both of them. If you have a free time could you please take a quick look and help me to answer why. and how to ask XAMLParser sending both to the code behide
Hi Marlon,
I’d like to know how to get rid of the error in the XAML editor when using CommandBehaviorCollection.Behaviours.
Thanks
Ian
Great.. ;D…
Was looking for the same stuff for Silverlight ;D… this is realy nice…
Thanks,
Akhil
Ian,
I was running into the same problem. Using the Visual Studio debugger, I tracked it down to the CommandBehavior.OnEventChanged method, where the e.NewValue is apparently null (and attempting to call ToString() on it). I just wrapped a null check around it and now it loads in the XAML designer view in both VS and Blend.
I like this solution and am contemplating using it, but want to look it over for such error handling first. Thanks, Marlon for a nice solution using the attached behavior pattern.
Greg
Doh! I think I just caused more problems. I’ll get back to you on that one…
Nope. That check was OK. The “problems” mentioned above were from some other experimental code.
Hi, Marlon!
I’m researching Attached command behavior and trying to compare your solution and this solution http://chris.59north.com/post/The-CommandManager-again.aspx
So you use IL for eventhandler generator, while other solution – doesn’t. Which makes it possible (at first glance and superficial testing) for using in SilverLight applications. Can You say why have You used IL? What advantages does it have? My knowledge in C# isn’t so deep so I can’t do it by myself. And I’ll appreciate your help!
because its the only way to generate event handlers at runtime…
There is another approach that uses the EventManager but it works only for routed events
Actually if the events you are trying to bind to follow the (object sender, EventArgs args) signature you can call Delegate.CreateDelegate for Event.EventHandlerType. All of the events on the WPF controls follow this signature so it shouldn’t be a problem.
This is how I get around the problem of not being able to generate IL in partial trust (We are writing an XBAP).
There is still the problem of VS 2008 complaining about the Behaviors collection but that is another matter.
that’s a very good point… nice idea dude!
Just to let you know marlon I think ACB is a great idea and fills a very real need when doing MVVM. As its been said before, “Some times you just need to get the event args”.
Plus there are a couple of cases where i want to take action off of an event that aren’t linked to any specific Command.
So thanks a bunch.
I am getting this error in xaml
The attachable property ‘Behaviors’ was not found in type ‘CommandBehaviorCollection’.
Code runs fine. But I can’t viw design screen.
Can you please let me know how this can be corrected?
thats a n issue with Cider the Designer for VS… hopefully it is fixed in VS 2010
First let me express my many thanks to you for the ACB!
Here is my fix regarding the Visual Studio Designer issue (I use VS2008):
///
/// Gets the Behaviors property.
/// Here we initialze the collection and set the Owner property
///
public static BehaviorBindingCollection GetBehaviors(DependencyObject d)
{
if (d == null)
throw new InvalidOperationException(“The dependency object trying to attach to is set to null”);
BehaviorBindingCollection collection = d.GetValue(BehaviorsProperty) as BehaviorBindingCollection;
if (collection == null)
{
collection = new BehaviorBindingCollection();
collection.Owner = d;
SetBehaviorsPrivately(d, collection);
}
return collection;
}
///
/// Just keep the definition of the attachable property ‘Behaviors’ intact
/// to allow Visual Studio designer to show properly instead of throwing the error:
/// The attachable property ‘Behaviors’ was not found in type ‘CommandBehaviorCollection’.
/// Actually this definition is not used at all at the run time.
///
public static void SetBehaviors(DependencyObject d, BehaviorBindingCollection value)
{
}
///
/// Provides a secure (private) method for setting the Behaviors property.
/// The main purpose here is to hook up the CollectionChanged event hanlder.
///
private static void SetBehaviorsPrivately(DependencyObject d, BehaviorBindingCollection value)
{
d.SetValue(BehaviorsPropertyKey, value);
INotifyCollectionChanged collection = (INotifyCollectionChanged)value;
collection.CollectionChanged += new NotifyCollectionChangedEventHandler(CollectionChanged);
}
But after fixed this, I got another error:
Property ‘Action’ was not found or is not serializable for type ‘Border’.
The problem I believ it is reated to Action type returned by GetAction method. I could do any one of the flowing three to fix the problem:
1. Set the method as non-public;
2. Change the method name;
3. Get rid of this method;
This fix is good both at the design time and run time. But I am confused by the presence of GetAction method.
I tested it the other day in VS 2010 Beta 2 and it worked so unless they do something completely stupid done between now and when they release ….
Got it.. Thanks Marlon for this wonderful concept.
Hi Marlon,
could you please elaborate a little on the Behavior hack?
You simply write “it’s a trick to get it work” in the comment for the BehaviorsPropertyKey a.k.a as BehaviorsInternal.
But could you tell me why it does work then?
Some for the “hack” with the freezable collection and so on. I can see that it really only works with the freezable… but why?
Besides, does really nobody have a clue why the Cider designer does not work with the behavior collection? Its really anoying.
But anyhow, great work Marlon, I love this behavior.
Hi, nice work!
But I’m having a problem, I’m trying to fire MouseLeftButtonUp as a Command but I always get null exception at CommandBehaviorBinding line 99. It seems that strategy is null. Any thoughts?
It also happens with Actions.
André Carlucci
Go it… so silly, it was a binding problem.
Cheers.
Loving this… the part where you generate the eventhandlers seems like magic
…
I want to use it in a project, but just to be sure what is the license of it?
Thanks Marlon, this is great. Only one question, and I may be asking too much – if I use an AttachedCommandBehavior to catch the PreviewKeyDown event, how can I get the actual key pressed in the command handler? Thanks again.
Hi Marlon, nice work!
But how to use in styles?
This code will not work:
…
…
Best regards Kays
Was looking for the same stuff for Silverlight ;D… this is realy nice…
Comment by Admin February 23, 2010 @ 6:50pm
hello, if its not too much of a problem could you take a look at a problem I am having.
I described it here, with source pls take a look:
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/53527ef7-97b5-41ec-bce0-f356312a6f4f
When using CommandBehavior, is any way to cancel an event? For instance, the Closing event, I would like to set CancelEventArg = true, if it is not ready to close yet.
Thanks!
Hehe I am really the only reply to your incredible read?
strategy is always null. How do I fix this
[...] для параметров. Одна из реализаций описана в статье AttachedCommandBehavior V2 aka ACB. Автор разработал библиотеку, позволяющую вызывать [...]
Pingback by MVVM подход к обработке события Click в ItemsControl - CodeHelper | July 15, 2010 |
I have a static command reference in a HierarchicalDataTemplate. It doesn’t seem to run the canexecute until the button is pressed
<HierarchicalDataTemplate
…
<Button
acb:CommandBehavior.Command="{x:Static vm:StiRosterExplorerViewModel.EditCommand}"
acb:CommandBehavior.Event="Click"
acb:CommandBehavior.CommandParameter="{Binding}"
…
am i missing something?
Hi,
I love things that you’ve done.
Well, I have two questions:
1. Is there new version of ACB (v.3 ?:)) ?
2. I can’t run v.2 example for CommandBehaviorCollection
…
there is no such things as Behaviors.
can you correct your example ?
Thank you,
Julian
Auto message: notify me when answer will be here
I’d like to add some detailed info to me question:
The attachable property ‘Behaviors’ was not found in type ‘CommandBehaviorCollection’
ups, it works, sorry for spam
glad it worked… with regards to V3 not sure… don’t really have anything else to add to it for now… did you have anything in mind?
Hi,
I’m trying to get a doubleclick on a ListboxItem, but I get an exception here because strategy is null. What am I doing wrong?
public void Execute()
{
strategy.Execute(CommandParameter);
}
…
Hi,
I have looked at your TestingPasswordBox Solution but I am however searching for a means of briefly displaying the actual character that is entered (this would help user if typing via a mobile app etc). Do you have suggestions on it may be possible to achieve this with a WPF PasswordBox.
Best wishes
Wayne
First, thanks Marlon for the excellent library! Regarding the example “Support for Collection of binding to commands” I was wondering how/can that attached read only collection be set in a style?
I’ve tried a couple things and get either a parameter count mismatch in the designer or if I try to define the bindings in a collection I get a runtime error.
Hey Marlon,
Thanks for sharing this library. Helped me a lot. Was just wondering if I can use this with the Infragistics controls as well.
Hi Marlon,
Thanks for your nice approach, Many Regards from my side.
I ran into a situation where I wanted to Execute a command only when Enter key is pressed and also the button binding this command should provide the visual effect like the button is Pressed.
For this I added a DefaultCommand in your solution and Used VisualTreeHelper to find the button binding the command under execution then changed buttons style before command execution and riverted the original button style after command has been executed.
it works fine and appears like button was clicked.
The problem is that it happend on Every Key press.I am not able to find a way to detect if Enter key was pressed.
The situation occcurs when I bind the CommandBehaviourCollection with Event name provided along with command. LIke:
Attached Behaviour Property does not work if set through Styles or Templates
Hello,
I have combo box inside datagrid datatemplate. Here the SelectionChanged event is not firing because in CommandBehaviorBinding strategy is always null.
The comment from Sandy i think is the problem that thorugh templates or style Behavior property doesn’t work. Any solution or workaround for this?
Regards
Imran
Attached Command Behaviour does not work if set through Styles or Templates..
strategy always comes as null..Try it..
hello
strange, its working for me..??????
Sandy is correct. That problem is what is keeping me from using the library.
The Action property doesn’t seem to be set in those situations.
I read about another solution to this problem: The ‘RelayCommand’ class. There are some examples using the class on the net.
Can anybody out there plz…….. help me this is not working for the TabControl SelectionChnaged changed event some exception Object reference set to null etc is thrown…
I got a problem with ResourceDictionaries, it won’t work with them. If i call the code in the xaml-file everything works fine, but if i move the style to a ResourceDictionary, it won’t work. Has anyone a soltuion to this??
I have no problems using it with styles, like this:
Note that the binding to the command is usually set to an element above de ListViewItem. It is difficult to debug these binding errors, because they’ll throw apparently unrelated exceptions. So check your code carefully if it is not working for you.
Oh great, the xaml is gone from my comment. Check this:
http://stackoverflow.com/questions/1035023/firing-a-double-click-event-from-a-wpf-listview-item-using-mvvm
Pretty awesome!
[...] with compile-time checking. I won’t stop on it in details as you could read about it here and here or [...]
Pingback by WPF 4.5 supports MarkupExtension in the event properties « A place for spare thoughts | September 27, 2011 |
Nice! Works perfect.. thanks!
Thank you very much for publishing this. Very elegant!
if try to catch the Loaded event, the VS2010 Designer crash.
I modify your code as is :
namespace AttachedCommandBehavior
{
///
/// Defines the command behavior binding
///
public class CommandBehaviorBinding : IDisposable
{
……….
///
/// Executes the strategy
///
public void Execute()
{
try
{
if (CommandParameter != null)
{
strategy.Execute(CommandParameter);
}
}
catch { }
}
sorry……leave the if statement….
[...] assign one event to a command, or I usually recommend to design one AttachedCommand, like this did: http://marlongrech.wordpress.com/2008/12/13/attachedcommandbehavior-v2-aka-acb . But just checking the MVVM Light Toolkit for Metro, it cannot provide the EventToCommand [...]
Pingback by Attached Command for Windows 8 Metro Style in C# | Programmer Solution | January 28, 2012 |
[...] Edit and Solved: Apparently MouseBinding steals the event and won’t pass it through. I solved it using AttachedBehaviors that we already had in our solution. I think taken from this http://marlongrech.wordpress.com/2008/12/13/attachedcommandbehavior-v2-aka-acb/ [...]
Pingback by ListBoxItem stealing Mouse clicks from ListBox | Build Future Repository | April 13, 2012 |
Great thanks for this library!
But in the second version I can’t use this solution programmly (in code-behind). I was able to write such a code earlier:
var polly = new Polygon();
…
polly.SetValue(CommandBehavior.EventProperty, “MouseLeftButtonUp”);
polly.SetBinding(CommandBehavior.CommandProperty, “MouseLeftButtonUpCommand”);
…
and now I can’t set binding directly to my FrameworkElement. I have to create BehaviorBinding, which is Freezable and doesn’t support SetBinding:
var behavior = new BehaviorBinding();
behavior.Event = “MouseLeftButtonUp”;
behavior.Owner = polly;
behavior.Command = ???
so, my question is how can I use wpf native binding directly from code??
[...] am trying to use AttachedCommandBehavior V2 to translate ListBoxItem events such as double click into commands that are execute against the [...]
Pingback by Apply multiple AttachedCommandBehaviors using a style | PHP Developer Resource | May 24, 2012 |
[...] prefer to use AttachedCommand Behaviors, which allow you to attach a Command to just about any UI [...]
Pingback by Capture DoubleClick in DataGrid | PHP Developer Resource | May 29, 2012 |
[...] I use an AttachedCommand Behavior which allows me to bind Events to ViewModel Commands. For example, you could [...]
Pingback by How to handle WPF event in MVVM for nested controls in a Window | PHP Developer Resource | May 29, 2012 |
Please consider creating a nuget package for this…
Hello
I want use with “PreviewMouseMove” event. But i don’t know how get the parameter “MouseEventArgs” in VM function.
Did someone get it work with Silverlight 5. Freezable & FreezableCollection is missing in Silverlight ;-(
Btw. it works awesome with WPF.
[...] http://marlongrech.wordpress.com/2008/12/13/attachedcommandbehavior-v2-aka-acb/ [...]
Pingback by A Brief Overview of MVVM | WPF Controls -- News On WPF -- ControlsInWPF.com | September 27, 2012 |
Tremendous things right here. I am very happy to find out your article.
Thank you and I was having a look forward to touch you.
Will you please drop me a e-mail?
[...] The font is called “Birth Of a Hero.ttf” it’s in the project folder under one called Fonts. You can get AttachedCommandBehavior here [...]
Pingback by Jot the WPF Sticky Note App | Jarloo | January 23, 2013 |
Awesome article! I have 1 question (so far), How can I set an input gesture on the SimpleCommand so that my view will execute the SimpleCommand when it detects that gesture. I have tried using the RoutedCommand as well, but it seems that the view doesn’t receive the gesture, so it doesn’t get passed to the command on the ViewModel.