c# - Binding an Event to ViewModel: Extending an article -
i've been searching information on binding wpf events commands defined in viewmodel.
i know there many frameworks can me, don't want use of them, implement scratch see how it's working.
i've found article: http://blog.functionalfun.net/2008/09/hooking-up-commands-to-events-in-wpf.html
and in general it's good. however, i've got 2 questions:
i'd have command parameter , bind parameter property in xaml (like
commandparameter={binding ...}
). how extend article handle ?in understanding in implementation use, let's say,
mousedoubleclick
event in 2 different ui elements, need define 2 different properties , attach them each of types want extend. isn't there smarter way (i.e. defining attached property once , use in elements)?
please consider using eventtocommand
behavior mvvm light library. related article: commands, relaycommands , eventtocommand).
also, there alternative eventtocommand
behavior (quote article):
note: can use
invokecommandaction
instead of mvvm light’seventtocommand
. behavior part of system.windows.interactivity dll. equivalenteventtocommand
, without of advanced features.
the example of using invokecommandaction
mentioned in note has been found here: executing command event of choice.
Comments
Post a Comment